Python- Pandas - 日期时间索引类型错误

时间:2014-12-30 20:59:59

标签: python pandas time-series typeerror python-datetime

我想计算两个特定日期之间的天数。我在代码中使用pandas。另外我在Mac OS-X Yosemite中使用带有anaconda 2.1的Python 3.4.2版本。 我收到以下错误

/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']

/Users/Hari/anaconda/lib/python3.4/site-packages/pandas/tseries/index.py in sub (self,other)

  return self.shift(-other)
  else:  # pragma: no cover
  raise TypeError(other)

TypeError:2014-12-02 00:00:00

变量date和self.dates [0]都是DateTimeindex。 你能帮我解决这个问题吗?

0 个答案:

没有答案