amazon web services - How to read a csv file from an s3 bucket using Pandas in Python -


i trying read csv file located in aws s3 bucket memory pandas dataframe using following code:

import pandas pd import boto  data = pd.read_csv('s3:/example_bucket.s3-website-ap-southeast-2.amazonaws.com/data_1.csv') 

in order give complete access have set bucket policy on s3 bucket follows:

{ "version": "2012-10-17", "id": "statement1", "statement": [     {         "sid": "statement1",         "effect": "allow",         "principal": "*",         "action": "s3:*",         "resource": "arn:aws:s3:::example_bucket"     } ] 

}

unfortunately still following error in python:

boto.exception.s3responseerror: s3responseerror: 405 method not allowed 

wondering if explain how either correctly set permissions in aws s3 or configure pandas correctly import file. thanks!

i realised need set permissions on each individual object within bucket in order extract using following code:

from boto.s3.key import key k = key(bucket) k.key = 'data_1.csv' k.set_canned_acl('public-read') 

and had modify address of bucket in pd.read_csv command follows:

data = pd.read_csv('https://s3-ap-southeast-2.amazonaws.com/example_bucket/data_1.csv') 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -