[Numpy-discussion] Selecting columns of a matrix

Travis Oliphant oliphant.travis at ieee.org
Wed Jun 21 12:50:26 EDT 2006

Johannes Loehnert wrote:
> Hi,
>> I'm not sure why bool arrays cannot be used as indices.
>> The "natural" solution to the original problem seemed to be:
>> M[:,V>0]
>> but this is not allowed.
> I started a thread on this earlier this year. Try searching the archive for 
> "boolean indexing" (if it comes back online somewhen).
> Travis had some reason for not implementing this, but unfortunately I do not 
> remember what it was. The corresponding message might still linger on my home 
> PC, which I can access this evening....

I suspect my reason was just not being sure if it could be explained 
consistently.  But, after seeing this come up again.   I decided it was 
easy enough to implement.

So, in SVN NumPy, you will be able to do


The V>0 will be replaced with integer arrays as if nonzero(V>0) had been 


More information about the NumPy-Discussion mailing list