可以直接使用s3fs直接写入
import pandas as pd
import s3fs
df = pd.DataFrame( [ [1, 1, 1], [2, 2, 2] ], columns=['a', 'b', 'c'])
bytes_to_write = df.to_csv(None).encode()
fs = s3fs.S3FileSystem(key='xxxxx', secret='xxxxxxx')
with fs.open('s3://top1--bigdata/backup/clickhouse/test.txt', 'wb') as f:
f.write(bytes_to_write)
```