I have a pandas data frame, called df.
df
I want to save this in a gzipped format. One way to do this is the following:
import gzip import pand
Better serialization with compression has recently been added to Pandas. (Starting in pandas 0.20.0.) Here is an example of how it can be used:
df.to_csv("my_file.gz", compression="gzip")
For more information, such as different forms of compression available, check out the docs.