title: Data frame indexing not working as it should be. Does not give error as well. Pandas-Python
body: <p>Lets say we have a dataframe:
  '''</p>
  
  <pre><code>df = pd.DataFrame({'A': 'foo bar foo bar foo bar foo foo'.split(),
                     'B': 'one one two three two two one three'.split(),
                     'C': np.arange(8), 'D': np.arange(8)**2})
  df
  </code></pre>
  
  <p>'''</p>
  
  <p>I am trying to set Values of column C to np.nan for a range of values in column C. </p>
  
  <p>I am trying to set nan values for all values in C that are less than 2 and greater than 5. </p>
  
  <p>I am doing like this: </p>
  
  <pre><code>'''df.loc[(df['C']&lt;2) &amp; (df['C']&gt;5),'C']=np.nan'''
  </code></pre>
  
  <p>It does not give any error or warning but also does nothing and the dataframe remains the same. </p>
  
  <p>Does anyone know whats going on? I also tried (not recommended solutions) but they also did not work: </p>
  
  <pre><code>''' 
  df['C'][(df['C']&lt;2) &amp; (df['C']&gt;5)]=np.nan
  
  df['C'].loc[(df['C']&lt;2) &amp; (df['C']&gt;5)]=np.nan
  '''
  </code></pre>