title: Concise/elegant integration using pandas Series elements as bounds
body: <p>I have a pandas dataframe, which I'll call df. It has columns 'A' and 'B'.</p>
  
  <pre><code>    A   B
  1   0   3
  2   1   4
  3   2   5
  </code></pre>
  
  <p>I want to add a column, 'C'. 'C' should be the definite integral of a function f on the bounds ('A', 'B'). At the moment, the function f is just f(x) = x, but in the future I will have different functions that'll need mapping in, so rather than trivially solving the integral and calculating 'C' as (B^2 - A^2)/2, I'd like to implement a programmatic solution.</p>
  
  <p>The following works:</p>
  
  <pre><code>from scipy.integrate import quad
  
  df['C'] = df.apply(lambda x: quad(lambda x: x, x[0], x[1])[0], axis=1)
  </code></pre>
  
  <p>However, it also seems really inelegant. I find it hard to believe that a dataframe method applying a lambda function that contains another function which takes a third function (also, for the moment, a lambda) as input is <em>really</em> the best way to do this.</p>
  
  <p>Is there a less syntactically terrible way to achieve my end goal of defining 'C' as the integral of f on the bounds ('A', 'B')?</p>