I have a datetime-indexed dataframe object with 100,000+ rows. I was wondering if there was a convenient way using pandas to get a subset of this dataframe that is within multiple date ranges.
For example, let us say that we have two date ranges:
(datetime.datetime(2016,6,27,0,0,0), datetime.datetime(2016,6,27,5,0,0)
and
(datetime.datetime(2016,6,27,15,0,0), datetime.datetime(2016,6,27,23,59,59)
Let us say we want to get all rows of a dataframe object that is in either the first date range or the second date range, where the dataframe object has rows for every second from 2016-06-27 00:00:00
to 2016-06-27 23:59:59
. Is there an easy way in pandas to do this?