I have an array y with indexes of values that must be incremented by one in another array x
just like x[y] += 1, This is an example:
>>> x = np.zeros(5,dtype=np.int)
>>> y = np.array([1,4])
>>> x
array([0, 0, 0, 0, 0])
>>> x[y] += 1
>>> x
array([0, 1, 0, 0, 1])
So far so good, but then I've this problem:
>>> x
array([0, 1, 0, 0, 1])
>>> y = np.array([1,1])
>>> x
array([0, 1, 0, 0, 1])
>>> x[y] += 1
>>> x
array([0, 2, 0, 0, 1])
I was expecting x to be array([0, 3, 0, 0, 1]): x[1] should be incremented by one twice,
but I got it with x[1] incremented just by one.
How can I did it? Why is that happening?