【问题标题】:Best way to upload gzip file to S3 bucket with boto3使用 boto3 将 gzip 文件上传到 S3 存储桶的最佳方式
【发布时间】:2020-12-24 09:36:57
【问题描述】:

我有一个大型 pandas 数据框,我已压缩并希望上传到 s3 存储桶。

最好的方法是什么? 使用 s3_client.upload_file?还是bucket.upload_fileobj? 我见过一堆解决方案,但无法理解最好的方式。 编辑:它是json格式 非常感谢!

【问题讨论】:

  • 您可以使用多种格式编写它。您要使用哪种格式? (csv,json..)?

标签: python pandas amazon-s3 gzip boto3


【解决方案1】:

这是一个假设 csv 是格式并且已安装 s3fs 的一行代码。

df.to_csv('s3://my_bucket/my_file.csv', compression='zip' )

【讨论】:

    猜你喜欢
    • 2019-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-02
    • 2017-07-12
    • 2019-03-03
    相关资源
    最近更新 更多