[Numpy-discussion] Selecting columns of a matrix

Simon Burton simon at arrowtheory.com
Wed Jun 21 00:23:49 CDT 2006


On Wed, 21 Jun 2006 13:48:48 +0900
"Bill Baxter" <wbaxter at gmail.com> wrote:

> 
> >>> a[:,num.where(v>0.5)[0]]
> array([[1, 2, 4],
>        [6, 7, 9]])
> 
> I'll put that up on the Matlab->Numpy page.

oh, yuck. What about this:

>>> a[:,num.nonzero(v>0.5)]
array([[0, 1, 3],
       [5, 6, 8]])
>>> 

Simon.


-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 




More information about the Numpy-discussion mailing list