How to Use Conditional Expressions With NumPy where() - Real Python
Briefly

The np.where() function allows for filtered analysis of array elements based on conditional predicates, similar to SQL's WHERE clause, yielding a new result array.
To utilize np.where(), you need to provide a condition, what to do if it matches, and what to do if it doesn’t, similar to a ternary operator.
Read at Realpython
[
]
[
|
]