[Numpy-discussion] argsort question (original) (raw)
Charles R Harris charlesr.harris at gmail.com
Thu Jun 8 11:34:05 EDT 2006
- Previous message (by thread): [Numpy-discussion] argsort question
- Next message (by thread): [Numpy-discussion] argsort question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Robert,
Modifying your example gives
In [3]: import numpy as nm
In [4]: a = nm.zeros( 10000 )
In [5]: b = nm.arange( 10000 )
In [6]: nm.alltrue( a.argsort(kind="merge" ) == b ) Out[6]: True
On 6/8/06, Robert Cimrman <cimrman3 at ntc.zcu.cz> wrote:
Hi all, I have just lost some time to find a bug related to the fact, that argsort does not preserve the order of an array that is already sorted, see the example below. For me, it would be sufficient to mention this fact in the docstring, although having order preserving argsort is also an option :). What do the developers think? In [33]:a = nm.zeros( 10000 ) In [34]:b = nm.arange( 10000 ) In [35]:nm.alltrue( nm.argsort( a ) == b ) Out[35]:False r.
Numpy-discussion mailing list Numpy-discussion at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20060608/c535c319/attachment.html>
- Previous message (by thread): [Numpy-discussion] argsort question
- Next message (by thread): [Numpy-discussion] argsort question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]