top of page
Search

Save Pandas data frame to S3

Well sometimes it just works when having the s3 as the destination but the following worked even when the above didn't:



from io import StringIO import boto3

import pandas as pd


df = pd.DataFrame([[1,2],[3,4]],['a','b']) csv_buffer = StringIO() df.to_csv(csv_buffer,index=False) s3_resource = boto3.resource('s3') s3_resource.Object(bucket, 'df.csv').put(Body=csv_buffer.getvalue())

ree

 
 
 

Comments


Subscribe Form

©2019 by Big Data. Proudly created with Wix.com

bottom of page