Last active
April 7, 2019 03:01
-
-
Save jaklinger/b87e0315816b59d1efc9874638f8b8b7 to your computer and use it in GitHub Desktop.
Read CSV (or JSON etc) from AWS S3 to a Pandas dataframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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