title: Logical operation on two columns of a dataframe
body: <p>In pandas, I'd like to create a computed column that's a boolean operation on two other columns. </p>
  
  <p>In pandas, it's easy to add together two numerical columns. I'd like to do something similar with logical operator <code>AND</code>. Here's my first try:</p>
  
  <pre><code>In [1]: d = pandas.DataFrame([{'foo':True, 'bar':True}, {'foo':True, 'bar':False}, {'foo':False, 'bar':False}])
  
  In [2]: d
  Out[2]: 
       bar    foo
  0   True   True
  1  False   True
  2  False  False
  
  In [3]: d.bar and d.foo   ## can't
  ...
  ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  
  <p>So I guess logical operators don't work quite the same way as numeric operators in pandas. I tried doing what the error message suggests and using <code>bool()</code>:</p>
  
  <pre><code>In [258]: d.bar.bool() and d.foo.bool()  ## spoiler: this doesn't work either
  ...
  ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  
  <p>I found a way that works by casting the boolean columns to <code>int</code>, adding them together and evaluating as a boolean.</p>
  
  <pre><code>In [4]: (d.bar.apply(int) + d.foo.apply(int)) &gt; 0  ## Logical OR
  Out[4]: 
  0     True
  1     True
  2    False
  dtype: bool
  
  In [5]: (d.bar.apply(int) + d.foo.apply(int)) &gt; 1  ## Logical AND
  Out[5]: 
  0     True
  1    False
  2    False
  dtype: bool
  </code></pre>
  
  <p>This is convoluted. Is there a better way?</p>