[SciPy-user] replacing numpy.inf in an array fast with 0.0 ?
wegwerp at gmail.com
Thu Nov 23 09:43:30 CST 2006
> print z
> Maybe there is a more efficient way.
I am a beginner with numpy myself too, but I am used to do this in
Matlab by using boolean arrays to index an array. If the same trick
works in scipy/numpy you should be able to do
z[isinf(z)] = 0.0
z[isnan(z)] = 0.0
saving you the call to where.
More information about the SciPy-user