saving csv file to s3 using boto3

后端 未结 3 998
-上瘾入骨i
-上瘾入骨i 2021-01-13 16:41

I am trying to write and save a CSV file to a specific folder in s3 (exist). this is my code:

from io import BytesIO
import pandas as pd
import boto3
s3 =         


        
3条回答
  •  借酒劲吻你
    2021-01-13 17:17

    This should work

    def to_s3(bucket,filename, content):
        client = boto3.client('s3')
        k = "folder/subfolder"+filename
        client.put_object(Bucket=bucket, Key=k, Body=content)
    

提交回复
热议问题