Utilities

Timeseries wrappers

As Binary Tree

class dynts.utils.asbtree(ts, **kwargs)

Wrap a dynts.TimeSeries and expose binary-tree like functionalities. A dynts.TimeSeries instance has a shortcut method which construct a asbtree. Here is an example:

>>> from dynts.utils.populate import randomts, date
>>> ts = randomts(cols = 2, start = date(2010,1,1), size = 50)
>>> dts = ts.asbtree()
>>> sts.find_ge(ts.start())
1
>>> sts.find_ge(ts.end())
49
find_ge(dt)

Building block of all searches. Find the index corresponding to the leftmost value greater or equal to dt. If dt is greater than the dynts.TimeSeries.end() a dynts.exceptions.RightOutOfBound exception will raise.

dt must be a python datetime.date instance.

find_le(dt)

Find the index corresponding to the rightmost value less than or equal to dt. If dt is less than dynts.TimeSeries.end() a dynts.exceptions.LeftOutOfBound exception will raise.

dt must be a python datetime.date instance.

As Hash Table

class dynts.utils.ashash(ts, **kwargs)

Iterators

dynts.utils.iterators.laggeddates(ts, step=1)

Lagged iterator over dates

dynts.utils.iterators.laggeditems(ts, step=1)

Iteration over lagged items.

dynts.utils.iterators.logdeltadt(ts, step=1, dcf=None)

Iterator which returns a log delta

Table Of Contents

Previous topic

Settings

Next topic

Exceptions

This Page