rana
rana

Reputation: 91

In google-colab pandas.read_pickle() is not working on pickle5

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.

Upvotes: 0

Views: 1464

Answers (2)

Roberto GC
Roberto GC

Reputation: 1

I was in a similar problem trying to open a "pickled" pd.dataframe. The solution for me was upgrade the default pandas version of google colab notebook. From 1.3.5 to 1.5.2

pip! install pandas==1.5.2

restart kernel

Upvotes: 0

Mohana
Mohana

Reputation: 489

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)

Upvotes: 1

Related Questions