read_pickle()

Pandas Pandas input output

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

Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    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 FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer