I'm trying to write a dataframe as a CSV file on S3 by using the s3fs library and pandas. Despite the documentation, I'm afraid the gzip compression parameter it's not working with s3fs.
def DfTos3Csv (df,file):
with fs.open(file,'wb') as f:
df.to_csv(f, compression='gzip', index=False)
This code saves the dataframe as a new object in S3 but in a plain CSV not in a gzip format. On the other hand, the read functionality it's working OK using this compression parameter.
def s3CsvToDf(file):
with fs.open(file) as f:
df = pd.read_csv(f, compression='gzip')
return df
Suggestions/alternatives to the write issue? Thank you in advance!.