考虑关注pandas dataframe df:
datestimes,price
2016-10-28 23:55:00,100.0
2016-10-31 00:00:00,122.4
将时间推回5分钟后:
df.datestimes - pd.Timedelta(minutes=5)
输出:
datestimes,price
2016-10-28 23:50:00,100.0
2016-10-30 23:55:00,122.4
2016-10-30不是营业日2016-10-28是,我如何将其移至2016-10-28 23:55:00如下?
datestimes,price
2016-10-28 23:50:00,100.0
2016-10-28 23:55:00,122.4
答案 0 :(得分:0)
典型的答案是过去一个工作日+未来一天:
df.datestimes +pd.datetools.Day(1) - pd.datetools.BDay(1)