Created
October 29, 2020 09:48
-
-
Save slchangtw/00bbf3de25fb36b593189763fcf82606 to your computer and use it in GitHub Desktop.
This file contains 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 | |
def read_s3(bucket, prefix): | |
s3 = boto3.resource("s3") | |
bucket = s3.Bucket(bucket) | |
prefix_objs = bucket.objects.filter(Prefix=prefix) | |
df = pd.concat([pd.read_excel(obj.get()["Body"].read()) for obj in prefix_objs]) | |
return df | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment