[SciPy-user] array manipulation

Joris De Ridder Joris.DeRidder@ster.kuleuven...
Sun Jul 6 17:00:03 CDT 2008


On 6 Jul 2008, at 6:48 , Yosef Meller wrote:

> On Thursday 03 July 2008 12:26:27 Robert Kern wrote:
>> On Thu, Jul 3, 2008 at 04:24, Nils Wagner <nwagner@iam.uni-stuttgart.de 
>> >
> wrote:
>>> How can I remove duplicate entries from an array ?
>>
>> numpy.unique1d()
>
> Why is there both numpy.unique1d() and numpy.unique()? Their code  
> seems very
> similar. And, if thery're different, it would be nice to see  
> unique1d in
> http://www.scipy.org/Numpy_Example_List

Good question...
unique1d() supports returning the indices of the unique values while  
unique() does not, but that's the only difference I can see. Perhaps a  
somewhat more consistent implementation would only consist of unique()  
and argunique(). But changing this will perhaps break too much code.

Also, at the moment there seems to be no unique()-like function that  
doesn't first flatten its input array. That is, a function that is  
able to transform, for example, array([[1,2],[3,4],[1,2]]) into  
array([[1,2],[3,4]]).

Joris



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the SciPy-user mailing list