Created
September 2, 2018 16:36
-
-
Save sminot/a82ad01eb28bd2114bf34fd6c7d99f6e to your computer and use it in GitHub Desktop.
Read feather file directly from AWS S3
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 io | |
import boto3 | |
import pandas as pd | |
def read_feather_file_from_s3(s3_url): | |
assert s3_url.startswith("s3://") | |
bucket_name, key_name = s3_url[5:].split("/", 1) | |
s3 = boto3.client('s3') | |
retr = s3.get_object(Bucket=bucket_name, Key=key_name) | |
return pd.read_feather(io.BytesIO(retr['Body'].read())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment