title: Vectorize integration of pandas.DataFrame
body: <p>I have a <code>DataFrame</code> of force-displacement data. The displacement array has been set to the <code>DataFrame</code> index, and the columns are my various force curves for different tests.</p>
  
  <p>How do I calculate the work done (which is "the area under the curve")?</p>
  
  <p>I looked at <a href="http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.trapz.html" rel="noreferrer"><code>numpy.trapz</code></a> which seems to do what I need, but I think that I can avoid looping over each column like this:</p>
  
  <pre><code>import numpy as np
  import pandas as pd 
  
  forces = pd.read_csv(...)
  work_done = {}
  
  for col in forces.columns:
      work_done[col] = np.trapz(forces.loc[col], forces.index))
  </code></pre>
  
  <p>I was hoping to create a new <code>DataFrame</code> of the areas under the curves rather than a <code>dict</code>, and thought that <code>DataFrame.apply()</code> or something might be appropriate but don't know where to start looking.</p>
  
  <p>In short:</p>
  
  <ol>
  <li>Can I avoid the looping?</li>
  <li>Can I create a <code>DataFrame</code> of work done directly?</li>
  </ol>
  
  <p>Thanks in advance for any help.</p>