I want to replace all values smaller than -999 with NaN and values falling within -999 to 0 with -0.1 in a 2D array.
I can replace one value using
data[data < -999] = 'nan'
However, when I use
data[data < -999] = 'nan'
data[data < 0] = -0.1
It says
RuntimeWarning: invalid value encountered in less
data[data < 0] = -0.1
How to replace values < -999 with NaN and values within the range of -999 to 0 with -0.1
data? What doesprint(type(data))return?