Getting _register_s3_control_events() Error

Question:

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?

Asked By: user3242036

||

Answers:

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
import pandas as pd
data = pd.read_csv('s3://bucket....csv')

If you are on python 3.4+, you need:

import boto3
import io
import pandas as pd
s3 = boto3.client('s3')
obj = s3.get_object(Bucket='bucket', Key='key')
df = pd.read_csv(io.BytesIO(obj['Body'].read()))
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.