Filter By Time Without Date in datetime64

Viewed 210

Let's say I have a dataframe with a column called my_date_time and its type is datetime64.

How can I filter by just the time portion?

For example, I would like to do something like:

df[some_magic_func(df['my_date_time']) < '09:30:00.123456']

Thanks.

1 Answers

You can use the following to filter :

df.loc[df.my_date_time.dt.time<pd.to_datetime('09:30:00.123456').time()]
Related