title: Pandas Recognizes Empty Cell From CSV as EMPTY SPACE Instead of nan
body: <p>I have a Data Frame that I read in as,</p>
  
  <pre><code>df = pd.read_csv(r'path\file.csv', encoding = "ISO-8859-1")
  </code></pre>
  
  <p>This is how it looks,</p>
  
  <pre><code>Machine ID  Machine June    July   August
  0   100     ABC      10     12     nan
  1   100     ABC      nan    15     15
  2   101     CDQ      12            20
  3   101     CDQ      15     32     11
  </code></pre>
  
  <p>And data types:</p>
  
  <pre><code>Machine ID  int 64
  Machine     object
  June        float64
  July        object
  August      float64
  </code></pre>
  
  <p>When I try to <code>groupby</code> like this,</p>
  
  <pre><code>machine_group = df.groupby(['Machine ID','Machine'])\['June', 'July', 'August'].sum()\
                      .reset_index() 
  </code></pre>
  
  <p>I only get <code>June</code> and <code>August</code> as <code>July</code> has an empty space/ empty string.</p>
  
  <pre><code>           ID    Machine     June    August 
  0         100     ABC        10      15
  1         101     CDQ        27      31
  </code></pre>
  
  <p>Therefore, I tried the <a href="https://stackoverflow.com/questions/48518735/convert-strings-to-float-in-all-pandas-columns-where-this-is-possible">fllowoing</a>,</p>
  
  <pre><code>df = df.apply(pd.to_numeric, errors = 'ignore')
  </code></pre>
  
  <p>This did not convert my <code>July</code> column to numeric/float64.</p>
  
  <p>Next, I tried <a href="https://stackoverflow.com/questions/13445241/replacing-blank-values-white-space-with-nan-in-pandas">this</a>,</p>
  
  <pre><code>df.replace(r'\s+', np.nan, regex=True)
  </code></pre>
  
  <p>This also, did not work. I still have the empty space in my data frame. Not sure what to do. </p>
  
  <p>I was reading this <a href="https://stackoverflow.com/questions/10867028/get-pandas-read-csv-to-read-empty-values-as-empty-string-instead-of-nan">post</a>, seems like I have the inverse issue of this. </p>
  
  <p>How can I make sure I have <code>nan</code> instead of empty string? because that empty string in <code>July</code> column makes the column to be <code>object</code> and it doesn't count for aggregation in <code>groupby</code> clause. </p>
  
  <p>(I checked the original .csv file and that exact line, it is normal empty cell as others, where other empty cells get read in as <code>nan</code> and this particular one is not)</p>
  
  <p>Any suggestions would be nice. </p>