[Numpy-discussion] py2/py3 pickling

Pauli Virtanen pav at iki.fi
Mon Aug 24 12:25:49 EDT 2015


24.08.2015, 01:02, Chris Laumann kirjoitti:
[clip]
> Is there documentation about the limits and workarounds for py2/py3 
> pickle/np.save/load compatibility? I haven't found anything except
> developer bug tracking discussions (eg. #4879 in github numpy).

Not sure if it's written down somewhere but:

- You should consider pickles not portable between Py2/3.

- Setting encoding='bytes' or encoding='latin1' should produce correct
results for numerical data. However, neither is "safe" because the
option also affects other data than numpy arrays that you may have
possibly saved.

- np.save/np.load are portable, as long as you don't save object arrays
or anything that gets converted to one by np.array (these are saved by
pickling)





More information about the NumPy-Discussion mailing list