Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
i = pd.date_range('2019-04-09', periods=4, freq='1D20min')
ts = pd.DataFrame({'P': [2, 3, 4, 5]}, index=i)
ts
Out[2]:
P
2019-04-09 00:00:00 2
2019-04-10 00:20:00 3
2019-04-11 00:40:00 4
2019-04-12 01:00:00 5
In [3]:
ts.between_time('0:15', '0:40')
Out[3]:
P
2019-04-10 00:20:00 3
2019-04-11 00:40:00 4

You get the times that are not between two times by setting start_time later
and end_time:

In [4]:
ts.between_time('0:40', '0:15')
Out[4]:
P
2019-04-09 00:00:00 2
2019-04-11 00:40:00 4
2019-04-12 01:00:00 5