title: Pandas Changing the format of NaN values when saving to CSV
body: <p>I am working with a df and using numpy to transform data - including setting blanks (or '') to NaN. But when I write the df to csv - the output contains the string 'nan' as oppose to being NULL.</p>
  
  <p>I have looked around but can't find a workable solution. Here's the basic issue:</p>
  
  <pre><code>df
  index x    y   z
  0     1   NaN  2
  1     NaN  3   4
  </code></pre>
  
  <p>CSV output: </p>
  
  <pre><code>index x    y   z
  0     1   nan  2
  1     nan  3   4
  </code></pre>
  
  <p>I have tried a few things to set 'nan' to NULL but the csv output results in a 'blank' rather than NULL:</p>
  
  <pre><code>dfDemographics = dfDemographics.replace('nan', np.NaN)
  dfDemographics.replace(r'\s+( +\.)|#', np.nan, regex=True).replace('', 
  np.nan)
  dfDemographics = dfDemographics.replace('nan', '')  # of course, this wouldn't work, but tried it anyway.
  </code></pre>
  
  <p>Any help would be appreciated.</p>