title: Pandas equivalent of SQL case when statement to create new variable
body: <p>I have this df:</p>
  
  <pre><code>data = np.array([[np.nan, 0], [2, 0], [np.nan, 1]])
  df = pd.DataFrame(data=data, columns = ['a', 'b'])
  </code></pre>
  
  <p>which looks like this:</p>
  
  <pre><code>     a    b
      --------
  0   NaN  0.0
  1   2.0  0.0
  2   NaN  1.0
  </code></pre>
  
  <p>My <strong>goal</strong> is to create a third column "c" that has a value of 1 when column "a" is equal to NaN and column "b" is equal to 0. "c" would be 0 otherwise. The simple SQL case statement would be:</p>
  
  <pre><code>(CASE WHEN a IS NULL AND b = 0 THEN 1 ELSE 0 END) AS C
  </code></pre>
  
  <p>The <strong>desired output</strong> is this:</p>
  
  <pre><code>     a    b   c
      -----------
  0   NaN  0.0  1
  1   2.0  0.0  0
  2   NaN  1.0  0
  </code></pre>
  
  <p>My (wrong) try:</p>
  
  <pre><code>df['c'] = np.where(df['a']==np.nan &amp; df['b'] == 0, 1, 0)
  </code></pre>
  
  <p>Many thx.</p>