I would like to get the value 07h00 every day, from a multi-day DataFrame that contains 24 hours of minute data every day.
import numpy as np import pandas as pd aframe = pd.DataFrame([np.arange(10000), np.arange(10000) * 2]).T aframe.index = pd.date_range("2015-09-01", periods = 10000, freq = "1min") aframe.head() Out[174]: 0 1 2015-09-01 00:00:00 0 0 2015-09-01 00:01:00 1 2 2015-09-01 00:02:00 2 4 2015-09-01 00:03:00 3 6 2015-09-01 00:04:00 4 8 aframe.tail() Out[175]: 0 1 2015-09-07 22:35:00 9995 19990 2015-09-07 22:36:00 9996 19992 2015-09-07 22:37:00 9997 19994 2015-09-07 22:38:00 9998 19996 2015-09-07 22:39:00 9999 19998
With this 10,000 rows of DataFrame spanning 7 days, how can I get the value of 7 AM every day as efficiently as possible? Suppose I might have to do this for very large tick databases, so I really appreciate the speed and low memory usage.
I know that I can index rows, for example:
aframe.ix["2015-09-02 07:00:00"] Out[176]: 0 1860 1 3720 Name: 2015-09-02 07:00:00, dtype: int64
But I need a basically templated templated query like
aframe.ix["* 07:00:00"]
source share