title: Pandas write blank values to CSV
body: <p>I have a DataFrame which looks like the following:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  df = pd.DataFrame(data={'data': [4, np.nan]})
  df
     data
  0   4.0
  1   NaN 
  </code></pre>
  
  <p>This DataFrame is generated after parsing data from various sources and sometimes I do not have values for some integer fields.  </p>
  
  <p>Eventually this data is to be stored in a CSV and I'd like to store this as an integer 4 and a blank. I have tried using <code>replace({numpy.nan: None})</code> and also <code>replace({numpy.nan: ''})</code> but that didn't help.  </p>
  
  <p>How do I ensure I get an integer 4 and a blank when this gets exported to CSV? The end goal is to use this CSV to load it into Redshift/Postgres which has explicitly defined datatypes.  </p>
  
  <p><strong>Update:</strong>
  How am I writing this file?  </p>
  
  <pre><code>with s3fs.open(s3_path, 'wb') as f:
          s = StringIO()
          df.to_csv(s, index=False, header=True)
          f.write(s.getvalue().encode('utf-8'))
          s = None
  </code></pre>