[Numpy-discussion] conditional array indexing

Michaell Taylor michaell.taylor at reis.com
Mon Jan 28 12:58:04 EST 2002


Very new user to Numpy, so excuse the question.  It relates to a fundamental 
issue which I have having trouble getting a grip on.

Specifically, say I have the following:

a = ([1,2,1,2,4,3,1,2,3,2,3,2])
b = ([4,3,5,2,4,5,3,6,3,2,5,6])
c = random variable of length=len(b)

I would like to get the value of C associated with the lowest value of b 
within groupings of a.  That is, there are three incidents of "1" in the a 
array.  The lowest value of b associated with the value 1 in the a index is 
"3".  This occurs in index value 6 on the a and b arrays.  Now, I would like 
to then know the value of c[6].  

Obviously the real problem is far more complex with len(a)==5000.  
Any ideas?  

Thanks in advance.

Michaell




More information about the NumPy-Discussion mailing list