Vorrei ottenere il valore 07h00 ogni giorno, da un DataFrame multiday con 24 ore di dati minuscoli in esso ogni giorno.Query stesso valore di ora ogni giorno in timeseries Pandas
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
In questo 10 000 fila dataframe estende 7 giorni, come faccio a ottenere il valore 07:00 ogni giorno nel modo più efficiente possibile? Supponiamo che potrei dover fare questo per database di tick molto grandi, quindi valuto molto la velocità e l'uso di memoria bassa.
So che posso indice con le stringhe come:
aframe.ix["2015-09-02 07:00:00"]
Out[176]:
0 1860
1 3720
Name: 2015-09-02 07:00:00, dtype: int64
Ma quello che mi serve è fondamentalmente una query stile jolly per esempio
aframe.ix["* 07:00:00"]