Skip to content

Instantly share code, notes, and snippets.

@jaklinger
Last active April 7, 2019 03:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaklinger/b87e0315816b59d1efc9874638f8b8b7 to your computer and use it in GitHub Desktop.
Save jaklinger/b87e0315816b59d1efc9874638f8b8b7 to your computer and use it in GitHub Desktop.
Read CSV (or JSON etc) from AWS S3 to a Pandas dataframe
import boto3
import pandas as pd
from io import BytesIO
bucket, filename = "bucket_name", "filename.csv"
s3 = boto3.resource('s3')
obj = s3.Object(bucket, filename)
with BytesIO(obj.get()['Body'].read()) as bio:
df = pd.read_csv(bio)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment