Re: [Numpy-discussion] indexing to sort with argsort(..., axis=1)

2010-04-13 Thread Angus McMorland
On 13 April 2010 04:01, Gökhan Sever gokhanse...@gmail.com wrote: On Mon, Apr 12, 2010 at 9:41 PM, Angus McMorland amcm...@gmail.comwrote: Hi all, I want to sort a 2d array along one dimension, with the indices returned by argsort, but the subsequent indexing syntax to get the sorted array

[Numpy-discussion] indexing to sort with argsort(..., axis=1)

2010-04-12 Thread Angus McMorland
Hi all, I want to sort a 2d array along one dimension, with the indices returned by argsort, but the subsequent indexing syntax to get the sorted array is not obvious. The following works, but I wonder if there is a simpler way: a = np.random.random(size=(5,3)) s = np.argsort(a, axis=1) sorted

Re: [Numpy-discussion] indexing to sort with argsort(..., axis=1)

2010-04-12 Thread josef . pktd
On Mon, Apr 12, 2010 at 10:41 PM, Angus McMorland amcm...@gmail.com wrote: Hi all, I want to sort a 2d array along one dimension, with the indices returned by argsort, but the subsequent indexing syntax to get the sorted array is not obvious. The following works, but I wonder if there is a

Re: [Numpy-discussion] indexing to sort with argsort(..., axis=1)

2010-04-12 Thread Gökhan Sever
On Mon, Apr 12, 2010 at 9:41 PM, Angus McMorland amcm...@gmail.com wrote: Hi all, I want to sort a 2d array along one dimension, with the indices returned by argsort, but the subsequent indexing syntax to get the sorted array is not obvious. The following works, but I wonder if there is a