[Numpy-discussion] indexing bug in numpy r2694

Travis Oliphant oliphant at ee.byu.edu
Wed Jun 28 14:47:32 EDT 2006


Keith Goodman wrote:

>On 6/28/06, Pau Gargallo <pau.gargallo at gmail.com> wrote:
>  
>
>>i don't know why 'where' is returning matrices.
>>if you use:
>>
>>    
>>
>>>>>idx = where(y.A > 0.5)[0]
>>>>>          
>>>>>
>>everything will work fine (I guess)
>>    
>>
>
>What about the second issue? Is this expected behavior?
>
>  
>
>>>idx
>>>      
>>>
>array([0, 1, 2])
>
>  
>
>>>y
>>>      
>>>
>
>matrix([[ 0.63731308],
>       [ 0.34282663],
>       [ 0.53366791]])
>
>  
>
>>>y[idx]
>>>      
>>>
>
>matrix([[ 0.63731308],
>       [ 0.34282663],
>       [ 0.53366791]])
>
>  
>
>>>y[idx,0]
>>>      
>>>
>matrix([[ 0.63731308,  0.34282663,  0.53366791]])
>
>I was expecting a column vector.
>
>  
>
This should be better behaved now in SVN.  Thanks for the reports.

-Travis





More information about the NumPy-Discussion mailing list