Python 更新后pandas中的apply函数存在问题

Python 更新后pandas中的apply函数存在问题,python,pandas,apply,Python,Pandas,Apply,我不能用以前版本的Pandas(在Python2.7下)的新版本0.9.1运行某段代码。 我运行的代码如下所示: myfunc = lambda x: makeDfCurve(frame,x) dates = Series(frame.index, index = frame.index) # new Time series filled temporarily # with dates taken from a certain dataframe 'frame' index # and he

我不能用以前版本的Pandas(在Python2.7下)的新版本
0.9.1
运行某段代码。 我运行的代码如下所示:

myfunc = lambda x: makeDfCurve(frame,x)
dates = Series(frame.index, index = frame.index) # new Time series filled temporarily 
# with dates taken from a certain dataframe 'frame' index
# and here's where the code crash:
frame['curve'] = dates.apply(myfunc) 
我得到以下错误:

TypeError:输入类型和输入不支持ufunc“subtract” 无法根据强制转换规则“safe”安全地强制转换为任何受支持的类型

我尝试递归函数,以查看在lambda定义中是否有一些日期作为x参数传递错误,但我在任何时候都得到了正确的结果。然而,这种方法已经不起作用了,我也不知道为什么。我会感谢你的帮助和想法

谢谢

另外,我想用以下内容编辑我的问题,因为事实上,在进一步调查之后:


此错误是由于新版本的Pandas导致的:TimeSeries的索引是“class'Pandas.lib.Timestamp'”类型,因此它为我的函数创建了一个问题,因为它需要一个datetime对象。

我最终通过检查新版本的文档解决了我的问题,其中解释了现在如何将索引视为时间戳,从而根据我的函数的要求,使用.to_pydatetime()方法在适当的datetime对象中转换索引值。

这只是一个需要datetime.datetime值的基本函数,我将编辑我的问题以提供有关此问题的更多信息。