Pandas の to_csv の保存先を s3 にする

SageMaker の Notebook から DataFrame を CSV にして S3 に保存する。

import pandas as pd
import boto3
from sagemaker import get_execution_role

role = get_execution_role()
bucket = 'BUCKET_NAME'

df = pd.DataFrame([1,2,3,4])

data_location = 's3://{}/results/test.csv'.format(bucket)

df.to_csv(data_location, index=False)

You'll only receive email when they publish something new.

More from daigo3
All posts