我刚刚从源代码(克隆的
github repo,>>>> setup.py install)编译和安装大熊猫.
事实是,对象序列化/反序列化的模块pickle的默认行为发生了可能部分被大熊猫内部模块覆盖.
我有相当一些数据类通过“标准”泡菜序列化,显然我不能反序列化了;特别是当我尝试反序列化一个类文件(肯定工作)时,我收到这个错误
In [1]: import pickle
In [2]: pickle.load(open('pickle_L1cor_s1.pic','rb'))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in ()
----> 1 pickle.load(open('pickle_L1cor_s1.pic','rb'))
/home/acorbe/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/pickle.pyc in load(file)
1376
1377 def load(file):
-> 1378 return Unpickler(file).load()
1379
1380 def loads(str):
/home/acorbe/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/pickle.pyc in load(self)
856 while 1:
857 key = read(1)
--> 858 dispatch[key](self)
859 except _Stop, stopinst:
860 return stopinst.value
/home/acorbe/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas-0.12.0_1090_g46008ec-py2.7-linux-x86_64.egg/pandas/compat/pickle_compat.pyc in load_reduce(self)
28
29 # try to reencode the arguments
---> 30 if self.encoding is not None:
31 args = tuple([ arg.encode(self.encoding) if isinstance(arg, string_types) else arg for arg in args ])
32 try:
AttributeError: Unpickler instance has no attribute 'encoding'
我有相当大的代码依赖于这个破坏.有什么快速的解决方法吗?如何再次获得默认腌制行为?
任何帮助赞赏
编辑:
我意识到我愿意解开的是一个列表,其中包括几个DataFrames.那就是大熊猫玩的地方.
我通过@Jeff github.com/pydata/pandas/pull/5661应用补丁.
另一个错误(可能与this相关)出现.
In [4]: pickle.load(open('pickle_L1cor_s1.pic','rb'))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 pickle.load(open('pickle_L1cor_s1.pic','rb'))
/home/acorbe/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/pickle.pyc in load(file)
1376
1377 def load(file):
-> 1378 return Unpickler(file).load()
1379
1380 def loads(str):
/home/acorbe/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/pickle.pyc in load(self)
856 while 1:
857 key = read(1)
--> 858 dispatch[key](self)
859 except _Stop, stopinst:
860 return stopinst.value
/home/acorbe/Canopy/appdata/canopy-1.1.0.1371.rh5-x86_64/lib/python2.7/pickle.pyc in load_reduce(self)
1131 args = stack.pop()
1132 func = stack[-1]
-> 1133 value = func(*args)
1134 stack[-1] = value
1135 dispatch[REDUCE] = load_reduce
TypeError: _reconstruct: First argument must be a sub-type of ndarray
熊猫版本的编码数据是(来自Canopy包管理器)
Size: 7.32 MB
Version: 0.12.0
Build: 2
Dependencies:
numpy 1.7.1
python_dateutil
pytz 2011n
md5: 7dd4385bed058e6ac15b0841b312ae35
我不知道我可以提供我试图解开的文件的最小例证.
它们相当大(O(100MB)),它们有一些非常小的依赖关系.