简体   繁体   中英

How can I remove a datetime index values from a pandas data frame that are in between 6:00 p.m. and 9:00 a.m.?

So I have a data frame with a date time index that looks like this:

2020-11-10 11:20:00-5:00
...
2020-11-13 11:43:00-5:00

And I want to remove the entire row from every column that has a date time that is in between 6:00 pm and 9:00 am for each day.

Thanks in advance.

You can use between_time :

df.between_time('9:00', '18:00')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM