write from panda dataframe to s3 with utf-8 encoding

Viewed 15

This code works:

os.system('pip install "s3fs==0.4"')
df.to_csv("s3://path",storage_options=aws_credentials,index=False, sep=';', encoding='utf-8-sig')

However this code doesnot works(code runs successfully without encoding):

csv_buffer = StringIO()
df.to_csv(csv_buffer, sep=";", index=False, encoding='utf-8-sig')
s3_resource = boto3.resource("s3")
s3_resource.Object('bucket', 'filename').put(Body=csv_buffer.getvalue())

How can I use utf-8-sig encoding without the library 's3fs'

0 Answers
Related