Numpy array index handling

phishboh at gmail.com phishboh at gmail.com
Fri Jul 13 22:52:17 CEST 2007


Thanks a lot for your reply.
I'll have a look at the numpy-discussion for future issues.

FYI, I'm using Python 2.4.3 for Windows (Enthought Edition) and the
included IPython shell. I found my mistake; importing of pylab.
E.g., this works
from pylab import * ; from scipy import * ; y = arange(3) ; y[y>1] = 0
but not
from scipy import * ; from pylab import * ; z = arange(3) ; z[z>1] = 0

Using the 'whos' command, I can see that y is an ndarray type, whereas
z is an array type.
(I also see a lot of functions, etc. How can I list just the
variables?)

It seems a bit risky to use 'from scipy import *'. Maybe it's better
to use 'import scipy' and then scipy.arange, to be sure what is
actually being used? Would there be any disadvanages with that
approach, other than more use of the keyboard?




More information about the Python-list mailing list