Re: [Numpydiscussion] [SciPyuser] unique, sort, sortrows
Hi David,
I can comment on unique1d, as I am the culprit. I am cc'ing to numpydiscussion as this is a numpy function.
Quoting "David M. Kaplan" David.Kaplan@ird.fr:
 Is there a simple equivalent of sortrows(a) (i.e., sorting by entire
rows)? Similarly, is there a simple equivalent of the matlab Y =
have you looked at lexsort?
 Is there an equivalent of [Y,I,J] = unique(X)? In this case, I is
the indices of the unique elements and J is an index from Y to X (i.e., where the unique elements appear in X. I can get I with:
I,Y = unique1d( X, return_index=True )
but J, which is very useful, is not available. I suppose I could do:
J = array([]) for i,y in enumerate(Y): J[ nonzero( y == X ) ] = i
But it seems like J is useful enough that there should be an easier way (or perhaps it should be integrated into unique1d, at the risk of adding more keyword arguments).
So basically Y = X[I] and X = Y[J], right? I do not recall matlab that well to know for sure. It certainly could be done, I could look at it after I return from Euroscipy (i.e. after Monday).
I would replace return_index argument by two arguments: return_direct (>I) and return_inverse (>J), ok? Does anyone propose better names?
Actually most of the methods in arraysetops could return optionally some index arrays. Would anyone use it? (I do not need it personally :)
cheers, r.
participants (1)

Robert Cimrman