简体   繁体   中英

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) 

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM