I get this error
ValueError: unsupported pickle protocol: 4
from this line of my code
full_df = pd.read_pickle('df_userID.pickle')
when running the script with python2.7
(on Ubuntu 14.04.5, 3.13.0-95-generic)
Thanks for help.
It looks like this pickle file has been created like as follows:
pickle.dump(df, file_name, protocol=4)
or
pickle.dump(df, file_name, protocol=-1)
and Python 2.x accepts only protocols: 0, 1, 2
Solution:
either use Pandas pickling or a lower protocol version:
df.to_pickle('/path/to/df.pickle') # preferred and version independent solution
or:
pickle.dump(df, '/path/to/df.pickle', protocol=2)
another option would be to use HDFStore (H5) or FeatherFormat - both options are very fast and reliable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With