我有一个pandas DataFrame,我想上传到新的CSV文件.问题是我不想在将文件传输到s3之前将其保存在本地.是否有像to_csv这样的方法直接将数据帧写入s3?我正在使用boto3.
这是我到目前为止:
import boto3
s3 = boto3.client('s3', aws_access_key_id='key', aws_secret_access_key='secret_key')
read_file = s3.get_object(Bucket, Key)
df = pd.read_csv(read_file['Body'])
# Make alterations to DataFrame
# Then export DataFrame to CSV through direct transfer to s3
Run Code Online (Sandbox Code Playgroud)