title: Uploading a Dataframe to AWS S3 Bucket from SageMaker
body: <p>I am new to AWS environment and trying to solve how the data flow works. After successfully uploading CSV files from S3 to SageMaker notebook instance, I am stuck on doing the reverse. </p>
  
  <p>I have a dataframe and want to upload that to S3 Bucket as CSV or JSON. The code that I have is below:</p>
  
  <pre><code>bucket='bucketname'
  data_key = 'test.csv'
  data_location = 's3://{}/{}'.format(bucket, data_key)
  df.to_csv(data_location)
  </code></pre>
  
  <p>I assumed since I successfully used <code>pd.read_csv()</code> while loading, using <code>df.to_csv()</code> would also work but it didn't. Probably it is generating error because this way I cannot pick the privacy options while uploading a file manually to S3. Is there a way to upload the data to S3 from SageMaker?</p>