[Numpy-discussion] unique return_index order?

Charles R Harris charlesr.harris at gmail.com
Fri Mar 21 21:01:45 EDT 2014


On Fri, Mar 21, 2014 at 6:49 PM, <josef.pktd at gmail.com> wrote:

>
>
>
> On Fri, Mar 21, 2014 at 8:46 PM, Charles R Harris <
> charlesr.harris at gmail.com> wrote:
>
>>
>>
>>
>> On Fri, Mar 21, 2014 at 6:26 PM, Alan G Isaac <alan.isaac at gmail.com>wrote:
>>
>>> The documentation of numpy.unique
>>> http://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html
>>> does not seem to promise that return_index=True will always index the
>>> *first* occurrence of each unique item, which I believe is the current
>>> behavior.
>>>
>>> A promise would be nice.
>>> Is it intended?
>>>
>>>
>> Yes, it is intended, although the required mergesort wasn't available for
>> all types before numpy 1.7.
>>
>
> Does this mean return_inverse works again for all cases, even with
> return_index?
>
> I removed return_index from my code in statsmodels because I make frequent
> use of return_inverse, which was broken. We don't have any unittests in
> statsmodels anymore that use both return_xxx.
>
>
I don't know, needs checking. Seems to work now with a simple trial array
of integers.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140321/0fbeae4a/attachment.html>


More information about the NumPy-Discussion mailing list