w3resource

Pandas DataFrame: to_pickle() function

DataFrame - to_pickle() function

The to_pickle() function is used to pickle (serialize) object to file.

Syntax:

DataFrame.to_pickle(self, path, compression='infer', protocol=4)

Parameters:

Name Description Type/Default Value Required / Optional
path  File path where the pickled object will be stored. str Required
compression   A string representing the compression to use in the output file. By default, infers from the file extension in specified path.  {'infer', 'gzip', 'bz2', 'zip', 'xz', None}
Default Value: 'infer'
Required
protocol Int which indicates which protocol should be used by the pickler, default HIGHEST_PROTOCOL  int Required

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - to_parquet() function
Next: DataFrame - to_csv() function



Follow us on Facebook and Twitter for latest update.