Reading a file from a private S3 bucket to a pandas dataframe

前端 未结 8 764
猫巷女王i
猫巷女王i 2020-12-08 10:19

I\'m trying to read a CSV file from a private S3 bucket to a pandas dataframe:

df = pandas.read_csv(\'s3://mybucket/file.csv\')

I can read

8条回答
  •  隐瞒了意图╮
    2020-12-08 10:27

    Note that if your bucket is private AND on an aws-like provider, you will meet errors as s3fs does not load the profile config file at ~/.aws/config like awscli.

    One solution is to define the current environment variable :

    export AWS_S3_ENDPOINT="myEndpoint"
    export AWS_DEFAULT_REGION="MyRegion"
    

提交回复
热议问题