title: Replacing blank spaces with null value for a subset of data frame
body: <p>For the following data frame, </p>
  
  <pre><code> id  words   A   B   C   D  E  
   1   new a   1       1   
   2   good v  1  
   3   star c          1
   4   never                  
   5   final   
  </code></pre>
  
  <p>I tried to replace blank space with null values using the following code:</p>
  
  <pre><code>df1.loc[:, ["A", "B", "C", "E", "D" ]].replace (r'\s+', np.nan, regex = True, inplace = True)
  </code></pre>
  
  <p>But it did not work. I also tried this code:</p>
  
  <pre><code>df1[["A", "B", "C", "E", "D" ]].replace (r'\s+', np.nan, regex = True, inplace = True)
  </code></pre>
  
  <p>It also did not work. </p>
  
  <p>But using the following code, it worked:</p>
  
  <pre><code>df1.A.replace (r'\s+', np.nan, regex = True, inplace = True)
  df1.B.replace (r'\s+', np.nan, regex = True, inplace = True)
  df1.C.replace (r'\s+', np.nan, regex = True, inplace = True)
  df1.D.replace (r'\s+', np.nan, regex = True, inplace = True)
  df1.E.replace (r'\s+', np.nan, regex = True, inplace = True)
  </code></pre>
  
  <p>Does any one know why ? Thanks. </p>