Given a list [5,2,4,5,1,2,4,5], how to do a sum resample like pandas.resample df.resample().sum() without the hasle of creating a DatetimeIndex?
inp = [5,2,4,5,1,2,4,5]
out = resample(inp, 2, how='sum')
>> [7, 9, 3, 9]
Note: This is because df.resample().sum() only accept datetime-like index. I have spent some time googling this topic but find nothing. Sorry if there is exist a same question like this.
Edit:
A manual solution might look like this
import numpy as np
def resample_sum(inp, window):
return np.sum(np.reshape(inp, (len(inp)//window, window)), axis=1)