read_pickle()

path ( file ) Path with file name to store the byte string of pickled data
compression(Optional )Type of compression, {'infer', 'gzip', 'bz2', 'zip', 'xz', None}
file to DataFrame by read_pickle() We can read the binary file and create a DataFrame data by using read_pickle().
What is pickle ?
read_pickle to read data from Python Pickle file and create a Pandas DataFrame
import pandas as pd
import pickle
my_data=pd.read_pickle('my_data.pkl')
print(my_data)
Output
   NAME  ID  MATH  ENGLISH
0  Ravi   1    30       20
1  Raju   2    40       30
2  Alex   3    50       40
The file is located in the current directory. Check for the file my_data.pkl . You can use path to read the file in different location.
my_data=pd.read_pickle("D:\my_data\my_data.pkl")

Compression

We can add compression option. ( You must have used the same type of compression while creating the file )
my_data=pd.read_pickle('my_data.pkl',compression='zip')
to_pickle()
Read how to pickle data stored in a MySQL table.
Pandas read_clipboard() read_html() read_csv() read_excel() to_excel()
Data input and output from Pandas DataFrame

Subhendu Mohapatra — author at plus2net
Subhendu Mohapatra

Author

🎥 Join me live on YouTube

Passionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.



Subscribe to our YouTube Channel here



plus2net.com







Python Video Tutorials
Python SQLite Video Tutorials
Python MySQL Video Tutorials
Python Tkinter Video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2025   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer