title: Use numpy.average with weights for resampling a pandas array
body: <p>I need to resample some data with numpys weighted-average-function - and it just doesn't work... .</p>
  
  <p>This is my test-case:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  time_vec = [datetime.datetime(2007,1,1,0,0)
               ,datetime.datetime(2007,1,1,0,1)
               ,datetime.datetime(2007,1,1,0,5)
               ,datetime.datetime(2007,1,1,0,8)
               ,datetime.datetime(2007,1,1,0,10)
               ]
  df = pd.DataFrame([2,3,1,7,4],index = time_vec)
  </code></pre>
  
  <p>A normal resampling without weights works fine (using the lambda function as a parameter to <code>how</code> is suggested here: <a href="https://stackoverflow.com/questions/19703179/pandas-resampling-using-numpy-percentile">Pandas resampling using numpy percentile?</a> Thanks!):</p>
  
  <pre><code>df.resample('5min',how = lambda x: np.average(x[0]))
  </code></pre>
  
  <p>But if i try to use some weights, it always returns a <code>TypeError: Axis must be specified when shapes of a and weights differ</code>:</p>
  
  <pre><code>df.resample('5min',how = lambda x: np.average(x[0],weights = [1,2,3,4,5]))
  </code></pre>
  
  <p>I tried this with many different numbers of weights, but it did not get better: </p>
  
  <pre><code>for i in xrange(20):
      try:
          print range(i)
          print df.resample('5min',how = lambda x:np.average(x[0],weights = range(i)))
          print i
          break
      except TypeError:
          print i,'typeError'
  </code></pre>
  
  <p>I'd be glad about any suggestions.</p>