pandas.DataFrame 中save方法


In [5]: frame.save('frame_pickle')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-f936768749d3> in <module>()
----> 1 frame.save('frame_pickle')

D:\software\Python27\lib\site-packages\pandas\core\generic.pyc in __getattr__(se
lf, name)
2358 return self[name]
2359 raise AttributeError("'%s' object has no attribute '%s'" %
-> 2360 (type(self).__name__, name))
2361
2362 def __setattr__(self, name, value):

AttributeError: 'DataFrame' object has no attribute 'save'

上網查了好多,最后在API Reference文檔中發現

把save換成to_pickle就可以了。由於我pandas是0.17.1(http://pandas.pydata.org/pandas-docs/stable/api.html)版本,我又去該版本下查了一下,已經save方法的介紹了,只有to_pickle,只有在這0.13.1下才說明已經被Deprecated。

同樣的加載的方法load方法,也被Deprecated.采用read_pickle。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM