Is there a MATLAB accumarray equivalent in numpy?

Use np.bincount with the weights optional argument. In your example you would do:

np.bincount(accmap, weights=a)

Leave a Comment