Home > Software engineering >  In google-colab pandas.read_pickle() is not working on pickle5
In google-colab pandas.read_pickle() is not working on pickle5

Time:03-30

I made a pickle file of a dataframe from my computer using pd.to_pickle() which I could not read in colab. It gives error ValueError: unsupported pickle protocol: 5. Please give a solution.

CodePudding user response:

You need to install pickle5 first, using:

!pip install pickle5

Then,

#Import the library
import pickle5 as pickle

path = 'path_to_pickle5'

with open(path, "rb") as dt:
  df = pickle.load(dt)
  • Related