[Numpy-discussion] unique() should return a sorted array

Robert Cimrman cimrman3 at ntc.zcu.cz
Tue Jul 4 04:51:20 CDT 2006


David Huard wrote:
> Here is a quick benchmark between numpy's unique, unique1d and sasha's
> unique:
> 
> x = rand(100000)*100
> x = x.astype('i')
> 
> %timeit unique(x)
> 10 loops, best of 3: 525 ms per loop
> 
> %timeit unique_sasha(x)
> 100 loops, best of 3: 10.7 ms per loop
> 
> timeit unique1d(x)
> 100 loops, best of 3: 12.6 ms per loop
> 
> So I wonder what is the added value of unique?
> Could unique1d simply become unique ?

It looks like unique1d and friends could use same facelifting with new
numpy features like boolean indexing :)

r.




More information about the Numpy-discussion mailing list