title: Pandas dataframe If else with logical AND involving two columns
body: <p>How to add logical <code>AND</code> in a control statement involving two columns of a pandas dataframe i.e.</p>
  
  <p>This works:</p>
  
  <pre><code>def getContinent(row):
      if row['Location'] in ['US','Canada']:
          val = 'North America'
      elif row['Location'] in['UK', 'Germany']:
          val = 'Europe'
      else:
          val = None
      return val
  
  df.apply(getContinent, axis=1)
  </code></pre>
  
  <p>Now I want to include an additional condition with another field <code>row['Sales']</code>:</p>
  
  <pre><code>def getContinent(row):
      if row['Location'] in ['US','Canada'] &amp; row['Sales'] &gt;= 100:
          val = 'North America'
      elif row['Location'] in['UK', 'Germany'] &amp; row['Sales'] &lt; 100:
          val = 'Europe'
      else:
          val = None
      return val
  
  df.apply(getContinent, axis=1)
  </code></pre>
  
  <blockquote>
    <p>ValueError: ('Arrays were different lengths: 6132 vs 2', u'occurred at index 0')</p>
  </blockquote>