I want to create some sort of a sum-up of my data, that can be of the form,
A B
------
10 2
20 4
5 6
5 8
9 14
I want to group these rows based on the values of column B by quantizing them in groups of a range of 5. So if some value of column B falls in the range 1-5, the row will belong to that group. In the example here rows 1 and 2 fall in group 1-5, whereas 3 and 4 belong to the group 6-10. Each group will then become only one row containing the values of column A. So we would end up with,
A B
------
15 1-5
5 6-10
9 11-15
How can this be done with pandas, without iterating over each row?