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}
protocol(Optional) , Int, we can use HIGHEST_PROTOCOL to get the latest
DataFrame to file by to_pickle() We can create a file with DataFrame data by using to_pickle(). We will create one DataFrame by using a dictionary.
import pandas as pd
import pickle
my_data = pd.DataFrame(data=my_dict)
my_data.to_pickle("my_data.pkl") # pickled
This is the data written to the current directory. Check for the file my_data.pkl . You can use path to store the file in different location.


We can add compression option. ( You must take care while reading the same file )


We can assign the integer or we can get the latest by using HIGHEST_PROTOCOL
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

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-2021 All rights reserved worldwide Privacy Policy Disclaimer