Given:
pd.DataFrame({'ranges': [2,4,6,2,4,1,2,5,3,2,3,5,6,3,2,1,4,6,3,2]})
I would like to have a new DataFrame where the 20 values (actually 1000 in my real case) get reduced to 4 values, each being the average (or other function) of the corresponding group of 5, so in other words:
average of (2,4,6 and 2), average of (4,1,2,5) etc.
It's like downsampling and it's related to binning. I am stumped. I bet it becomes a one-liner.