Numpy – Replace a number with NaN June 11, 2023 by Tarik A[A==NDV]=numpy.nan A==NDV will produce a boolean array that can be used as an index for A