title: How to write a pandas dataframe to_json() to s3 in json format
body: <p>I have an AWS lambda function which creates a data frame, I need to write this file to a S3 bucket.</p>
  <pre><code>import pandas as pd
  import boto3
  import io
  
  # code to get the df
  
  destination = &quot;output_&quot; + str(datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%S')) + '.json'
  
  df.to_json(destination) # this file should be written to S3 bucket
  
  </code></pre>