Is anyone can provide example how to create zip file from csv file using Python/Pandas package? Thank you
Advertisement
Answer
Use
df.to_csv('my_file.gz', compression='gzip')
From the docs:
compression : string, optional a string representing the compression to use in the output file, allowed values are ‘gzip’, ‘bz2’, ‘xz’, only used when the first argument is a filename
See discussion of support of zip
files here.