我有这个数据框:
DateTime
0 2020-04-04 10:15:40
1 2020-04-04 10:15:56
2 2020-04-04 11:07:11
3 2020-04-04 11:08:14
4 2020-04-04 11:18:46
. .
. .
我想将此数据帧重新采样到秒箱(范围更短)。
我试过:我的数据报dfd.resample('30S')[0:5]在哪里dfd,但它给了我TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'RangeIndex'.
我也DateTime通过做转换为日期时间类型,dfd['DateTime'] = pd.to_datetime(dfd['DateTime'])但它仍然给我同样的错误。