Writing pandas dataframe to S3 bucket (AWS)
You can use boto3 package also for storing data to S3:
from io import StringIO # python3 (or BytesIO for python2)import boto3bucket = 'info' # already created on S3csv_buffer = StringIO()df.to_csv(csv_buffer)s3_resource = boto3.resource('s3')s3_resource.Object(bucket, 'df.csv').put(Body=csv_buffer.getvalue())
This
"s3.console.aws.amazon.com/s3/buckets/info/test.csv"
is not a S3 URI, you need to pass a S3 URI to save to s3. Moreover, you do not need to import s3fs (you only need it installed),
Just try:
import pandas as pddf = pd.DataFrame()# df.to_csv("s3://<bucket_name>/<obj_key>")# In your casedf.to_csv("s3://info/test.csv")
NOTE: You need to create bucket on aws s3 first.