Use numpy.average with weights for resampling a pandas array
问题 I need to resample some data with numpys weighted-average-function - and it just doesn't work... . This is my test-case: 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) A normal resampling without weights works fine (using the lambda function as a parameter to how is suggested