title: saving csv file to s3 using boto3
body: <p>I am trying to write and save a CSV file to a specific folder in s3 (exist).
  this is my code:   </p>
  
  <pre><code>from io import BytesIO
  import pandas as pd
  import boto3
  s3 = boto3.resource('s3')
  
  d = {'col1': [1, 2], 'col2': [3, 4]}
  df = pd.DataFrame(data=d)
  
  csv_buffer = BytesIO()
  
  bucket = 'bucketName/folder/'
  filename = "test3.csv"
  df.to_csv(csv_buffer)
  content = csv_buffer.getvalue()
  
  def to_s3(bucket,filename,content):
    s3.Object(bucket,filename).put(Body=content)
  
  to_s3(bucket,filename,content)
  </code></pre>
  
  <p>this is the error that I get:</p>
  
  <pre><code>Invalid bucket name "bucketName/folder/": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$"
  </code></pre>
  
  <p>I also tried :</p>
  
  <pre><code>bucket = bucketName/folder
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>bucket = bucketName
  key = folder/
  s3.Object(bucket,key,filename).put(Body=content)
  </code></pre>
  
  <p>Any suggestions?</p>