Python Forum

Full Version: Working with date indexes (pandas)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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