Diana Ponce Faerron
Diana Ponce Faerron

Reputation: 11

pandas error when trying to load pickle file

I am trying to open a .pickle file Vehicle Price Dataset based on Craigslist Cars+Trucks Data: https://www.kaggle.com/austinreese/craigslist-carstrucks-data, however, I am getting the error below:

Traceback (most recent call last):
  File "D:/Universidad/Beca/Certificacion/Unsupervised Learning/Week1/Homework 1 - Diana Ponce.py", line 20, in <module>
    train_data, train_labels, test_data, test_labels = pickle.load(f)
  File "pandas\_libs\internals.pyx", line 572, in pandas._libs.internals.BlockManager.__cinit__
TypeError: __cinit__() takes at least 2 positional arguments (0 given)

I have exported the needed libraries but am still unable to open the file. Both the .pickle file and the .py are stored in the same location.

This is the code I am using:

import numpy as np
import pandas as pd 
import pickle

with open("vehicle_price_dataset.pickle", "rb") as f:
      train_data, train_labels, test_data, test_labels = pickle.load(f) 

Upvotes: 0

Views: 2233

Answers (1)

sansergi
sansergi

Reputation: 11

It sounds like a versioning issue: the version used to create the model is not the same version installed on the machine that is used to unpickle the model. Perhaps confirming you are using Pickle version 4.0 could solve the problem.

Upvotes: 1

Related Questions