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 multip
I feel the best option will be to use the direct checks rather than using loc function:
df = df[((df.index >= '2016-6-27') & (df.index <= '2016-6-27 5:00'))
| ((df.index >= '2016-6-27 15:00') & (df.index < '2016-6-28'))]
It works for me.
Major issue with loc function with a slice is that the limits should be present in the actual values, if not this will result in KeyError.