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:softwarePython27libsite-packagespandascoregeneric.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。

原文地址:https://www.cnblogs.com/longjshz/p/5029053.html