Skip to content

Instantly share code, notes, and snippets.

@revolutionisme
Created March 16, 2020 15:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revolutionisme/1d7603789cfbdc02f0d47a05137b24ee to your computer and use it in GitHub Desktop.
Save revolutionisme/1d7603789cfbdc02f0d47a05137b24ee to your computer and use it in GitHub Desktop.
Reading and Writing data to/from s3 using pandas and s3fs
import pandas as pd
import s3fs
fs = s3fs.S3FileSystem(profile_name='aws_profile')
with fs.open("s3://my-bucket/file.csv", "rb") as f:
csv_df = pd.read_csv(f)
fs = s3fs.S3FileSystem(profile_name='other_aws_profile')
with fs.open("s3://another-bucket/file.csv", "wb") as f
df.to_csv(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment