Python-Pandas-date-time索引类型错误

Python-Pandas-date-time索引类型错误,python,pandas,time-series,typeerror,python-datetime,Python,Pandas,Time Series,Typeerror,Python Datetime,我想计算两个特定日期之间的天数。我在代码中使用熊猫。我还在MacOS-XYosemite中使用Python 3.4.2版本和Anaconda2.1。 我得到以下错误 /Users/Hari/Documents/EdenWorks/crop_planning.py in plant_crops(self, dates, crop) overflow = crop.copy() # Get date offsets and plant size date_offsets = (dates - sel

我想计算两个特定日期之间的天数。我在代码中使用熊猫。我还在MacOS-XYosemite中使用Python 3.4.2版本和Anaconda2.1。 我得到以下错误

/Users/Hari/Documents/EdenWorks/crop_planning.py in plant_crops(self, dates, crop)
overflow = crop.copy()
# Get date offsets and plant size
date_offsets = (dates - self.dates[0]).days
plant_width = crop['Plant width']
plant_length = crop['Plant length']
/sub中的Users/Hari/anaconda/lib/python3.4/site-packages/pandas/tseries/index.py(self,other)

类型错误:2014-12-02 00:00:00

变量日期和self.dates[0]都是DateTimeindex。
你能帮我做一下吗?

看看地图,似乎DateTimeIndex是一个数组。您需要将DateTimeIndex转换为可以减去的格式。此外,您的代码似乎与错误消息混淆了。。。花点时间把这些都说清楚。谢谢你,巴富巴。我试图将变量类型化为int类型,但仍然得到相同的错误。阿琼:对不起。我已经编辑了这个问题,并试图让它更清楚一点
  return self.shift(-other)
  else:  # pragma: no cover
  raise TypeError(other)