I have an array:
a = np.array([0,0,0,0,0,0])
I want to add some other array into each index of a, while the index can appear more than one times. I want to get the some of each index. I write:
a[np.array([1,2,2,1,3])] += np.array([1,1,1,1,1])
but get a to be:
array([0, 1, 1, 1, 0, 0])
But what I want is to get:
array([0, 2, 2, 1, 0, 0])
How to implement this in numpy without for loop?