1 Jun
2011
1 Jun
'11
4:32 p.m.
On Wed, Jun 1, 2011 at 11:31 AM, Mark Miller <markperrymiller@gmail.com> wrote:
I'd love to see something like a "count_unique" function included. The numpy.unique function is handy, but it can be a little awkward to efficiently go back and get counts of each unique value after the fact.
Does bincount do what you're after? [~/] [1]: x = np.random.randint(1,6,5) [~/] [2]: x [2]: array([1, 3, 4, 5, 1]) [~/] [3]: np.bincount(x) [3]: array([0, 2, 0, 1, 1, 1]) Skipper