Created
March 16, 2020 15:30
-
-
Save revolutionisme/1d7603789cfbdc02f0d47a05137b24ee to your computer and use it in GitHub Desktop.
Reading and Writing data to/from s3 using pandas and s3fs
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 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