I have an array where I record hits
a=np.zeros(5)
and an array with the indices of the hits, for example I have 2 hits on index 2
hits=np.array([2,2])
so I want to increase index 2 of a by 2

I tried:
a[hits]+=1
but it gives array([ 0., 0., 1., 0., 0.])
does someone have a suggestion?
bins=np.bincount(hits)
a[:len(bins)] += bins
a
array([ 0., 0., 2., 0., 0.])