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

Nicolas ROUX nicolas.roux at st.com
Mon Oct 27 07:41:06 EDT 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