title: Convert CSV to Bytes-like Object in python
body: <p>I have a dataframe and I'm changing that datafram to csv using</p>
  <pre><code>new_csv = df.to_csv()
  
  </code></pre>
  <p>Now i want to convert this new_csv into bytes object . When I try this:</p>
  <pre><code>new_bytes_obj = io.BytesIO(new_csv) 
  </code></pre>
  <p>I get an error :</p>
  <blockquote>
  <p>TypeError: a bytes-like object is required, not 'str</p>
  </blockquote>
  <p>Any way to do that?</p>