There are various formats that a data structure or object can be stored in. Let's go over a few of them.
Writing to exotic file types
to_pickle()
When a Python object is pickled, it gets saved to disk. Pickling serializes the object first, before writing it. It involves converting objects such as lists, Dicts, DataFrames, and trained machine learning models into a character stream.
Let's convert the DataFrame we defined earlier into pickle format:
df.to_pickle('pickle_filename.pkl')
It is also possible to compress pickle files before they are written. Compression schemes such as gzip, bz2, and xz are supported:
df.to_pickle("pickle_filename.compress", compression="gzip")
By default...