Trying to teach myself some python and I am super confused from the docs what the where function does. Can somebody explain the example from the documentation below step by
Basically used as follows:
np.where(condition, value if condition is True, value if condition is False)
In this case:
condition is [[True, False], [True, True]]
value if condition is True is [[1, 2], [3, 4]].
value if condition is False is [[9, 8], [7, 6]].
The final result of array([[1, 8], [3, 4]]) is equal to the array from 'value if condition is True', except for the one location in condition where it is False. In this case, the value of 8 comes from the second array.