• SDK 版本
Python 3.9
pandas 1.3.1
  • 示例代码
# coding: utf-8
# author: qbit
# date: 2021-08-08
# summary: pandas 直接读取中国区 s3 文件

import pandas as pd

s3options = {
    "client_kwargs": {"region_name": "cn-northwest-1"},  # 中国宁夏区
    "key": "aws_access_key_id",
    "secret": "aws_secret_access_key",
}

# 如果操作系统已配置命令行可访问 s3
# 可以不用 storage_options 参数
df = pd.read_csv(
    "s3://qbit-cn-northwest-1/data/word.csv", storage_options=s3options
)

print(df.head())
本文出自 qbit snap

qbit
268 声望279 粉丝