[Pythonmac-SIG] Fast way to get a list of unique values?
Chris Barker
Chris.Barker@noaa.gov
Mon, 09 Sep 2002 20:48:08 -0700
Robb Brown wrote:
> I have a large array (Numeric) of integers. I'd like to get a list
> of all the unique values in that array. Naturally I'd like to avoid
> a for loop. Is there an easy way to do this in Python?
I can't think of one off the top of my head, but this would be a good
question for the Numeric Mailing list:
https://lists.sourceforge.net/lists/listinfo/numpy-discussion
I'm sure someone on that list will have a trick up their sleeve.
Also, this would be a good chance to check out Pyrex, rather than C
code, of you really need the speed:
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
-Chris