I am trying to write a dataframe in gsipped csv in python pandas using the following:
import pandas as pd import datetime import csv import gzip
It just creates a csv called "foo-YYYYMMDD.csv.gz" and not the actual gzip archive.
I also tried adding this:
#Turn to_csv statement into a variable d = df.to_csv('foo-%s.csv.gz' % todaysdatestring, sep='|', header=True, index=False, quoting=csv.QUOTE_ALL, compression='gzip', quotechar='"', doublequote=True, line_terminator='\n')
What fails. Any ideas?
source share