Python 比较时间值和日期时间索引

Python 比较时间值和日期时间索引,python,pandas,dataframe,datetime,time,Python,Pandas,Dataframe,Datetime,Time,我有两条时间线。和一个日期时间索引 t1 = "08:45:00" t2 ="17:30:00" #idx = pd.DatetimeIndex(['2019-06-17 08:45:00', '2019-06-17 08:46:00', '2019-06-17 08:47:00', '2019-06-17 08:48:00', '2019-06-17 08:49:00', '2019-06-17 08:50:00', '2019-06-17 08

我有两条时间线。和一个日期时间索引

t1 = "08:45:00"
t2 ="17:30:00"



#idx = 
pd.DatetimeIndex(['2019-06-17 08:45:00', '2019-06-17 08:46:00', '2019-06-17 08:47:00', '2019-06-17 08:48:00', '2019-06-17 08:49:00', '2019-06-17 08:50:00', '2019-06-17 08:51:00',
... 
 '2019-06-17 08:52:00', '2019-06-17 08:53:00', '2019-06-17 08:54:00', '2019-08-20 11:51:00', '2019-08-20 11:52:00', '2019-08-20 11:53:00', '2019-08-20 11:54:00', 
'2019-08-20 11:55:00', '2019-08-20 11:56:00', '2019-08-20 11:57:00', '2019-08-20 11:58:00', '2019-08-20 11:59:00', '2019-08-20 12:00:00'],
 dtype='datetime64[ns]', length=66436, freq=None)
每次我这样转换它们时:

 t1 =   pd.to_datetime( pd.Series(t1)[0],format='%H:%M:%S').time

 t2 =   pd.to_datetime( pd.Series(t1)[0],format='%H:%M:%S').time
然后尝试通过以下方式进行比较:

temp_idx     = pd.Series(idx.time, index=index)
temp_idx     = temp_idx.loc[(temp_idx>=t1) & (temp_idx<=t2)]

它将时间视为一个“内置函数”或“方法”。

请回答问题并包括整个错误回溯
TypeError:\uuuuu new\uuuuuuuuu()获得了一个意外的关键字参数“length”
请修复最小的、可重复的示例。它会导致错误。请回答问题并包括整个错误回溯
TypeError:\uuuuu new\uuuuu()获得意外的关键字参数“length”
请修复最小的、可重复的示例。它会导致错误。
TypeError: '>=' not supported between instances of 'datetime.time' and 'builtin_function_or_method'