[Numpy-discussion] How to do: y[y<T] = y+T

Nicolas ROUX nicolas.roux@st....
Mon Oct 27 06:41:06 CDT 2008


Hello,

I hope this is not a silly question ;-)
I have a Numpy array, and I want to process it with :
  "if the value is lower than Threshold, then increase by Threshold"


I would like to translate it as:
 y[y<Treshold] = y + Treshold

To benefit from the Numpy speed.
But this doesn't work, any idea ?

Thanks,
Cheers,
Nicolas.



More information about the Numpy-discussion mailing list