title: Using rolling_apply on a DataFrame object
body: <p>I am trying to calculate Volume Weighted Average Price on a rolling basis.</p>
  
  <p>To do this, I have a function vwap that does this for me, like so:</p>
  
  <pre><code>def vwap(bars):
      return ((bars.Close*bars.Volume).sum()/bars.Volume.sum()).round(2)
  </code></pre>
  
  <p>When I try to use this function with rolling_apply, as shown, I get an error:</p>
  
  <pre><code>import pandas.io.data as web
  bars = web.DataReader('AAPL','yahoo')
  print pandas.rolling_apply(bars,30,vwap)
  
  AttributeError: 'numpy.ndarray' object has no attribute 'Close'
  </code></pre>
  
  <p>The error makes sense to me because the rolling_apply requires not DataSeries or a ndarray as an input and not a dataFrame.. the way I am doing it.</p>
  
  <p>Is there a way to use rolling_apply to a DataFrame to solve my problem?</p>