title: python value conditional on two columns
body: <p>I have the following dataset:</p>
  
  <pre><code>id  Rank   condition1    condition2  result 
  1    2      50           0            0  
  1    2      50           0            0
  2    55     50           1            0
  2    55     50           1            0
  </code></pre>
  
  <p>I want to make the result column to 1 conditional on the two columns condition 1 and condition 2. </p>
  
  <p>The Result should become 1 if <code>rank &lt;= condition 1 AND if condition2 = 0</code></p>
  
  <pre><code>id  Rank   condition1    condition2  result 
  1    2      50           0            1  
  1    2      50           0            1
  2    55     50           1            0
  2    55     50           1            0
  </code></pre>
  
  <p>I have tried the following code but get "invalid syntax".</p>
  
  <pre><code>df["result"][df[condition2] = 0 &amp; df["Rank"]&lt;= df["condition1"]] = 1
  </code></pre>
  
  <p>Can somebody help me in finding the error? I know how to make this command conditional on one condition, but I do not know how to incorporate the second condition with the AND command.</p>