Re: [Tutor] Elegant argument index sort

2007-11-08 Thread bob gailer
Dinesh B Vadhia wrote:
 I'm sorting a 1-d (NumPy) matrix array (a) and wanting the index 
 results (b). 
I can't tell from your comments and code what you want. Please provide a 
better explanation and give an example of input and output numbers. Also 
I am not familiar with argsort.
 This is what I have:
  
 b = a.argsort(0)
 b = b+1
  
 The one (1) is added to b so that there isn't a zero index element.  
 Is there a more elegant way to do this?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Elegant argument index sort

2007-11-08 Thread Kent Johnson
Dinesh B Vadhia wrote:
 I'm sorting a 1-d (NumPy) matrix array (a) and wanting the index results 
 (b).  This is what I have:
  
 b = a.argsort(0)
 b = b+1
  
 The one (1) is added to b so that there isn't a zero index element.  Is 
 there a more elegant way to do this?

b = a.argsort(0) + 1

?

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Elegant argument index sort

2007-11-07 Thread Dinesh B Vadhia
I'm sorting a 1-d (NumPy) matrix array (a) and wanting the index results (b).  
This is what I have:

b = a.argsort(0)
b = b+1

The one (1) is added to b so that there isn't a zero index element.  Is there a 
more elegant way to do this?

Dinesh
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor