[SciPy-user] Question about slicing

Hugo Gamboa hgamboa at gmail.com
Fri Jan 20 07:16:17 EST 2006


In the code below the commented line makes numpy complains. The
intended result is produced by getting the indexes with where. If I
use

Am I asking too much with slicing or it should simply work?

Thanks in advance.

Hugo Gamboa



from numpy import *

a=arange(10)
b=rand(10,10)
i=a>3

r=b[i]  #works fine but only in the first axis

#b[:,i] <- IndexError: arrays used as indices must be of integer type
v=b[:,where(i)]




More information about the SciPy-User mailing list