Sum array by number in numpy
Assuming I have a numpy array like:
[1,2,3,4,5,6]
and another array:
[0,0,1,2,2,1]
I want to sum the items in the first array by group (the second array) and obtain n-groups results in group number order (in this case the result would be [3, 9, 9]). How do I do this in numpy?