Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time series in Python up to microseconds

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.

like image 540
Abruzzo Forte e Gentile Avatar asked May 11 '26 14:05

Abruzzo Forte e Gentile


1 Answers

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)
like image 130
jathanism Avatar answered May 13 '26 03:05

jathanism



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!