2012-12-20 7 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強制的初始時間滯後。 –