【发布时间】:2017-10-05 02:10:05
【问题描述】:
我想通过特定的数据时间段过滤数据帧,如下面的代码。
df2 = df2['Dates'].between_time(pandas.to_datetime('5/13/2015 8:41'), pandas.to_datetime('5/13/2015 8:55'))[['Dates','Category']]
但出现错误“TypeError: Index must be DatetimeIndex” 这是数据框
我试过了
df2 = pandas.read_csv(path2,parse_dates=[0])
喜欢其他帖子的回复之一,但仍然遇到相同的错误。 有谁知道这里发生了什么?
【问题讨论】:
标签: python pandas python-datetime