Re: [Numpy-discussion] default behavior of argsort

2010-05-15 Thread Dr. Phillip M. Feldman
efiring wrote: > > On 05/14/2010 11:03 AM, Dr. Phillip M. Feldman wrote: >> > It is perfectly reasonable to have an algorithm that uses values > sorted along > the last axis, even if that dimension sometimes turns out to be one. > > Eric > Excellent point! I agree. Case closed. Phillip -

Re: [Numpy-discussion] default behavior of argsort

2010-05-14 Thread Chris Barker
Chris Barker wrote: > I can't find it right now, but I'm pretty sure there is a function that > will re-shape an array to remove the length-1 dimensions -- maybe that's > what the OP needs. it's np.squeeze() -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOA

Re: [Numpy-discussion] default behavior of argsort

2010-05-14 Thread Chris Barker
>> Second, treating a >> unit dimension differently from a non-unit dimension *is* making it a >> special case, and often--usually--one does not want that. It is >> perfectly reasonable to have an algorithm that uses values sorted along >> the last axis, even if that dimension sometimes turns out

Re: [Numpy-discussion] default behavior of argsort

2010-05-14 Thread Robert Kern
On Fri, May 14, 2010 at 17:29, Eric Firing wrote: > On 05/14/2010 11:03 AM, Dr. Phillip M. Feldman wrote: >> >> Robert Kern-2 wrote: >>> >>> On Wed, May 12, 2010 at 20:19, Dr. Phillip M. Feldman >>>  wrote: When operating on an array whose last dimension is unity, the default behav

Re: [Numpy-discussion] default behavior of argsort

2010-05-14 Thread Eric Firing
On 05/14/2010 11:03 AM, Dr. Phillip M. Feldman wrote: > > > > Robert Kern-2 wrote: >> >> On Wed, May 12, 2010 at 20:19, Dr. Phillip M. Feldman >> wrote: >>> >>> When operating on an array whose last dimension is unity, the default >>> behavior of argsort is not very useful: >>> >>> |6> x=random.

Re: [Numpy-discussion] default behavior of argsort

2010-05-14 Thread Dr. Phillip M. Feldman
Robert Kern-2 wrote: > > On Wed, May 12, 2010 at 20:19, Dr. Phillip M. Feldman > wrote: >> >> When operating on an array whose last dimension is unity, the default >> behavior of argsort is not very useful: >> >> |6> x=random.random((4,1)) >> |7> shape(x) >>                      <7> (4, 1) >>

Re: [Numpy-discussion] default behavior of argsort

2010-05-14 Thread Robert Kern
On Wed, May 12, 2010 at 20:19, Dr. Phillip M. Feldman wrote: > > When operating on an array whose last dimension is unity, the default > behavior of argsort is not very useful: > > |6> x=random.random((4,1)) > |7> shape(x) >                      <7> (4, 1) > |8> argsort(x) >                      <

[Numpy-discussion] default behavior of argsort

2010-05-12 Thread Dr. Phillip M. Feldman
When operating on an array whose last dimension is unity, the default behavior of argsort is not very useful: |6> x=random.random((4,1)) |7> shape(x) <7> (4, 1) |8> argsort(x) <8> array([[0], [0], [0], [0]]) |9> argsort(x,axis=0)