em70
em70

Reputation: 6081

Filter by hour in Pandas

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"]

Upvotes: 16

Views: 18468

Answers (2)

Manre
Manre

Reputation: 939

Hope this helps: df[(df.Time > '08:00') & (df.Time < '08:05')]

Upvotes: 5

Related Questions