I want to iterate through a numpy ndarray and, if any values are less than X, replace one of them with X.
I have tried doing array_name[ array_name < X] = X but this replaces all of the values that are less than X.
I can use a for loop, but I feel like there's probably a more concise way already bundled with numpy.
for i in array_name:
if i < X:
i = X
break
Is there a way to do this more elegantly?