Answered by : wrong-wallaby-xkhj9ehg03h9
with open('filename', 'rb') as f: x = pickle.load(f)
Source : https://stackoverflow.com/questions/35067957/how-to-read-pickle-file | Last Update : Wed, 02 Sep 20
Answered by : tirbo06
'''3 ways to open file with python (e.g: 'my_pickle_file.pkl)':'''
# ORIGINAL
with open('my_pickle_file.pickle', 'rb') as f : pickle_file = pickle.load(f)
# QUICK
pickle_file = pickle.load(open("my_pickle_file.pickle", 'rb'))
# PANDAS
pickle_file = pd.read_pickle('my_pickle_file.pickle')
Source : | Last Update : Tue, 19 Oct 21
Answered by : distinct-dragonfly-k5vxmokglvbe
data = pd.read_pickle('dtm.pkl')
Source : | Last Update : Sat, 26 Jun 21
Answered by : elated-eland-zhpjy32x4ecu
import pickle
with open('serialized.pkl', 'rb') as f: data = pickle.load(f)
Source : https://stackoverflow.com/questions/24906126/how-to-unpack-pkl-file | Last Update : Fri, 04 Feb 22
Answered by : combative-curlew-51dvmrxoaupz
with open(MODEL_LABELS_FILENAME, "wb") as f: pickle.dump(lb, f)
Source : | Last Update : Sun, 24 Apr 22
Answered by : you
import pickle
# Specify the path to the pickle file
file_path = 'path/to/your/pickle/file.pkl'
# Load the pickle file
with open(file_path, 'rb') as file: data = pickle.load(file)
# Now you can use the loaded data
print(data)
Source : | Last Update : Tue, 19 Sep 23
Answered by : yesid-cano-castro
import pandas as pd
#the object type is the one defined in the pickle, it is not a dataframe
object = pd.read_pickle(r'filepath')
Source : https://stackoverflow.com/questions/35067957/how-to-read-pickle-file | Last Update : Tue, 24 May 22
Answered by : wrong-wallaby-xkhj9ehg03h9
with open('filename', 'a') as f: pickle.dump(data, f)
Source : https://stackoverflow.com/questions/35067957/how-to-read-pickle-file | Last Update : Wed, 02 Sep 20
Answered by : syed-nayeem-ridwan
# Way 1
import pickle
with open('filename.pkl', 'rb') as file: data = pickle.load(file)
# Way 2
df = pd.read_pickle('filename.pkl')
Source : | Last Update : Sun, 12 Nov 23