Hi everyone,

I've recently put together a pull request that adds an `axis` kwarg to
`numpy.unique` so that `unique`can easily be used to find unique
rows/columns/sub-arrays/etc of a larger array.

https://github.com/numpy/numpy/pull/3584

Currently, this works as a warpper around `unique`. If `axis` is specified,
it reshapes the input to a 2D contiguous array, views each row as a single
item, then passes it on to `unique`.  For int and string dtypes, each row
is viewed as a void dtype and therefore bitwise-equality is used for
comparisons.  For all other dtypes, the each row is viewed as a structured
array.

The current implementation has two main drawbacks:

   1. For anything other than ints and strings, it's relatively slow.
   2. It doesn't work with object arrays of any sort.

I'd appreciate any thoughts/feedback folks might have on both the general
idea and this specific implementation.  It think it's a worthwhile
addition, but I'm biased.

Thanks!
-Joe
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to