Python 使用重采样数据和宽度=1绘制条形图,以及如何避免';将整数和整数数组加减到时间戳';?

Python 使用重采样数据和宽度=1绘制条形图,以及如何避免';将整数和整数数组加减到时间戳';?,python,matplotlib,error-handling,Python,Matplotlib,Error Handling,尝试使用重采样数据绘制条形图时,我遇到以下错误: FutureWarning: Addition/subtraction of integers and integer-arrays to Timestamp is deprecated, will be removed in a future version. Instead of adding/subtracting `n`, use `n * self.freq` dx = [convert(x0 + ddx) - x for ddx

尝试使用重采样数据绘制条形图时,我遇到以下错误:

FutureWarning: Addition/subtraction of integers and integer-arrays to Timestamp is deprecated, will be removed in a future version.  Instead of adding/subtracting `n`, use `n * self.freq`
  dx = [convert(x0 + ddx) - x for ddx in dx]
我的代码:

plt.bar(df.index, df.tally, width=1)
plt.show()
这将按预期返回图形,但带有
FutureWarning

df
是重采样数据,如下所示。无论我使用每周、每月、每季度、每年以及我假设的任何频率,它都会发生

日期计数
2015-01-31 7
2015-02-28 4
2015-03-31 2
2015-04-30 2

删除
width=1
会删除错误,但会返回一个几乎看不见的细白线的无用条形图

我认为,绘图是这样的,因为每个月只有一天或任何频率绘制数据。因此,在一个有5年数据点的坐标轴上,这些计数很小——这对于散点图来说不是问题

我不明白为什么我会出错。我在哪里向时间戳添加整数

也许有更好的方法将重采样数据绘制为时间序列