Python Forum
Working with date indexes (pandas) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Working with date indexes (pandas) (/thread-17298.html)



Working with date indexes (pandas) - dervast - Apr-05-2019

Hi all,
I have a dataset with time stamps and I am happy that I can use timestamps as indexes.
I have an issue though that I do not know how, I can make variables of time periods that the indexing will understand.

For example in the data below
data_test.index[0]

[22]:
Timestamp('2019-02-08 14:10:07.409000')

how I can pick with variables (with fixes string is easy) rows that are inside that time period?

Also how I can make a new time variable that now includes a shift?

For example something like

data_test.index[0].timedelta(milliseconds=500)


does not work but the idea is to be able to to have a rolling window based on time stamps that returns me subsets of the initial data frame (pandas).

Can you please suggest me which functions to use?

Thanks a lot
Alex