title: Indexing rows by boolean expression and column by position pandas data frame
body: <p>How do I set the values of a pandas dataframe slice, where the rows are chosen by a boolean expression and the columns are chosen by position?</p>
  
  <p>I have done it in the following way so far:</p>
  
  <pre><code>&gt;&gt;&gt; vals = [5,7]
  &gt;&gt;&gt; df = pd.DataFrame({'a':[1,2,3,4], 'b':[5,5,7,7]})
  &gt;&gt;&gt; df
     a  b
  0  1  5
  1  2  5
  2  3  7
  3  4  7
  &gt;&gt;&gt; df.iloc[:,1][df.iloc[:,1] == vals[0]] = 0
  &gt;&gt;&gt; df
     a  b
  0  1  0
  1  2  0
  2  3  7
  3  4  7
  </code></pre>
  
  <p>This works as expected on this small sample, but gives me the following warning on my real life dataframe:</p>
  
  <pre><code>SettingWithCopyWarning: 
  A value is trying to be set on a copy of a slice from a DataFrame
  </code></pre>
  
  <p>What is the recommended way to achieve this?</p>