2012-12-20 6 views
-1

我有一个日期时间作为索引数据帧对象:问题在印刷时间序列图,从数据帧的熊猫

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),但没有运气,并且绘图也无法处理来自bug url的数据。

+1

你使用哪个版本的熊猫?我会建议升级到最新的稳定版本! (这对我来说在'0.10'上用matplotlib'1.1.1'写得很好。) –

+0

似乎忘了在升级matplotlib后重新启动ipython笔记本,或者没有重新加载matplotlib。一旦我重新启动笔记本电脑,现在工作正常。谢谢! –

回答

0

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

+1

你应该接受你自己的答案来解决这个问题。 – tacaswell

+0

非常感谢,在我接受我自己的答案之前,等待SO强制的初始时间滞后。 –