I have a pandas dataframe including some value
s and count
for each:
df = pd.DataFrame({'value':[1,2,3,11,12,13,21,22,23], 'count':[100,200,300, 1100,1200,1300, 2100,2200,2300]})
value count
1 100
2 200
3 300
11 1100
12 1200
13 1300
21 2100
22 2200
23 2300
what I want is to adding up the counts within a given equal size windows of value
. For example, for a window_size=10, I want to have:
value count
[0, 10) 600
[10, 20) 3600
[20, 30) 6600
what is the best way to do that?