Question

I would like to handle time series in Python.

It has been suggested to me that I use scikit.timeseries but I need to handle up to microseconds and this last, as far as I know, handles up to milliseconds.

Do you know any other library able to do that? At some point I need to merge 2 time series sampled at different times, and I would like to avoid rewriting such features or any new classes from scratch whenever it is possible.

Was it helpful?

Solution

The datetime module handles microseconds:

>>> import datetime
>>> now = datetime.datetime.now()
>>> now.microsecond 
38672

Performing arithmetic operations against a datetime using a timedelta object returns a new datetime object:

>>> yest = now - datetime.timedelta(days=1)
>>> yest
datetime.datetime(2010, 5, 9, 12, 37, 19, 38672)
>>> now
datetime.datetime(2010, 5, 10, 12, 37, 19, 38672)

Performing arithmetic operations against datetime objects returns a timedelta object.

>>> now - yest
datetime.timedelta(1)

OTHER TIPS

Read about RedBlackPy. You can read article with code examples. I think that RedBlackPy.Series is what you want (it is built for convenient work with time series). RedBlackPy is available for macosx and linux now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top