Python 将timnedelta列添加到时间戳列时出错
我需要将一列不均匀的时间戳移动一列不均匀的时间增量。我试图添加这两列,但得到一个TypeError 我有一个带有datetime列的timeseries时间戳Python 将timnedelta列添加到时间戳列时出错,python,date,datetime,pandas,shift,Python,Date,Datetime,Pandas,Shift,我需要将一列不均匀的时间戳移动一列不均匀的时间增量。我试图添加这两列,但得到一个TypeError 我有一个带有datetime列的timeseries时间戳 time 2011-01-01 00:00:00+01:00 2011-01-01 00:00:00+01:00 2011-01-01 00:15:00+01:00 2011-01-01 00:15:00+01:00 2011-01-01 00:30:00+01:00 2011-01-01 00:30:00+01:00
time
2011-01-01 00:00:00+01:00 2011-01-01 00:00:00+01:00
2011-01-01 00:15:00+01:00 2011-01-01 00:15:00+01:00
2011-01-01 00:30:00+01:00 2011-01-01 00:30:00+01:00
以及另一个具有增量值增量的时间序列:
2011-01-01 00:00:00+01:00 00:15:00
2011-01-01 00:15:00+01:00 00:15:00
2011-01-01 00:30:00+01:00 00:30:00
现在我尝试通过timestaps.adddelta或timestaps+delta添加这两个
但两者都有错误:
TypeError: ufunc 'add' not supported for the input types, and the inputs could not
be safely coerced to any supported types according to the casting rule 'safe'
单独的计算效果良好:
时间戳[1]+增量[1]
结果显示时间戳“2011-01-01 00:30:00+0100”,tz='欧洲/柏林'
我做错了什么?解决此任务的最佳方法是什么?您使用的是哪个版本的pandas和numpy?对我来说,这似乎有效。或者,你可以添加一个小的可复制的例子,用代码来制作这两个系列吗?