I am trying to read a csv from an S3 bucket using my jupyter notebook. I have previously read this csv before and had no issues but now am receiving an error.
Here is the code I am running:
import pandas as pd
list = pd.read_csv(r's3://analytics/wordlist.csv')
And the error I am getting is:
An error was encountered:
_register_s3_control_events() takes 2 positional arguments but 6 were given
I thought it may be the S3 bucket permissioning but it is public to my organization and so shouldn't be the issue. Any ideas what might be wrong?
CodePudding user response:
You could use boto to import the csv from s3. Boto is a python library for AWS.
By the way, this should work:
import boto
data = pd.read_csv('s3://bucket....csv')
If you are on python 3.4 , you need:
import boto3
import io
s3 = boto3.client('s3')
obj = s3.get_object(Bucket='bucket', Key='key')
df = pd.read_csv(io.BytesIO(obj['Body'].read()))