indices = np.array([1, 2, 2, 1, 3])
values = np.array([1, 1, 1, 1, 1])
a = np.array([0, 0, 0, 0, 0, 0])
for i, ix in enumerate(indices):
    a[ix] += values[i]
a
How to accumulate an array by index in numpy?