title: Convert Pandas DataFrame Column From String to Int Based on Conditional
body: <p>I have a dataframe that looks like</p>
  
  <p>df</p>
  
  <pre><code>viz  a1_count  a1_mean     a1_std
  n         3        2   0.816497
  y         0      NaN        NaN 
  n         2       51  50.000000
  </code></pre>
  
  <p>I want to convert the "viz" column to 0 and 1, based on a conditional. I've tried: </p>
  
  <pre><code>df['viz'] = 0 if df['viz'] == "n" else 1
  </code></pre>
  
  <p>but I get:</p>
  
  <pre><code>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>