我有一个数据帧,它的索引是datetime.time,而DataFrame.index和datetime.time中没有方法来移动时间。datetime.time有replace,但这只适用于序列中的单个项?
下面是使用的索引示例:
In[526]: dfa.index[:5]
Out[526]: Index([21:12:19, 21:12:20, 21:12:21, 21:12:21, 21:12:22], dtype='object')
In[527]: type(dfa.index[0])
Out[527]: datetime.time
这个对我有用:
利亚姆的链接看起来很棒,但也可以查看
pandas.Timedelta
-看起来它与NumPy和Python的时间增量很好地配合。https://pandas.pydata.org/pandas-docs/stable/timedeltas.html
相关问题 更多 >
编程相关推荐