Given a 2 x d dimensional numpy array M, I want to count the number of occurences of each column of M. That is, I'm looking for a general version of bincount
.
What I tried so far: (1) Converted columns to tuples (2) Hashed tuples (via hash
) to natural numbers (3) used numpy.bincount
.
This seems rather clumsy. Is anybody aware of a more elegant and efficient way?