-1

我有一个以日期时间为索引的 DataFrame 对象:

In [210]:
f
f.plot(legend=True)

Out[210]:
                         user_time  sys_time  wait_io_time
date_time                                             
2012-11-01 08:59:27          3         1             0
2012-11-01 08:59:32          0         0             0
2012-11-01 08:59:37         20         2             1
2012-11-01 08:59:42          0         0             0
2012-11-01 08:59:47          0         0             0

f.plot() 导致此错误:

-> 1367     plot_obj.generate()
--> 674         self._make_plot()
-> 1000             self._make_ts_plot(data, **self.kwds)
---> 81     left, right = _get_xlim(ax.get_lines())
--> 220         left = min(x[0].ordinal, left)
AttributeError: 'numpy.int64' object has no attribute 'ordinal'

我确实看到一个线图,显示来自 user_time 数据的值,因此怀疑来自 sys_time 的数据值可能导致问题。根据https://github.com/pydata/pandas/issues/1737的建议,我安装了更新版本的 matplotlib(1.1.1)但没有运气,并且在错误 url 的数据上绘图也失败了。

4

1 回答 1

0

这似乎适用于安装的最新 matplotlib 库。我升级后忘记重新启动 ipython 笔记本进程或重新加载 matplotlib。

于 2012-12-20T21:47:35.943 回答