I\'m looking for a fast solution to MATLAB\'s accumarray in numpy. The accumarray
accumulates the elements of an array which belong to the same index. An exampl
It depends on what exactly you are trying to do, but numpy unique has a bunch of optional outputs that you can use to accumulate. If your array has several identical values, then unique will count how many of the identical values there are by setting the return_counts option to true. In some easy applications, this is all that you need to do.
numpy.unique(ar, return_index=False, return_inverse=False, return_counts=True, axis=None)
You can also set the index to true and use it to accumulate a different array.