【发布时间】:2020-08-04 06:17:22
【问题描述】:
这是普通的列
0 06:55:22
1 06:55:23
2 06:55:24
3 06:55:25
4 06:55:26
我想将该列放在索引中,问题是当我尝试使用方法 resample() 时,我总是遇到同样的问题:
TypeError: 仅对 DatetimeIndex、TimedeltaIndex 或 PeriodIndex 有效,但获得了 'Index' 的实例
我一直在使用它来将时间列更改为
datetime dt['Time'] = pd.to_datetime(dt['Time'],format).apply(lambda x: x.time())
【问题讨论】:
标签: python pandas datetime object indexing