How can I filter a DataFrame indexed by datetime so that I get only the entries within certain hours of every day?
I am looking for something equivalent to the following R
code for an xts
object
df["09:00:00::17:00:00"]
You want the between_time
method: http://pandas.pydata.org/pandas-docs/dev/generated/pandas.DataFrame.between_time.html#pandas.DataFrame.between_time
Hope this helps: df[(df.Time > '08:00') & (df.Time < '08:05')]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With