where() (NumPy)

np.where(condition, x, y) builds a new array choosing elements from x where the condition is True and from y where it is False. Called with only a condition…