I have been trying to understand the numpy where function but not getting anywhere. I can understand simple comparisons such as where value > otherValue, but this example, from the documentation is not becomming clearer.
I would appreciate an easy to understand breakdown of this. thanks for any help provided:
>>> np.where([[True, False], [True, True]],
... [[1, 2], [3, 4]],
... [[9, 8], [7, 6]])
array([[1, 8],
[3, 4]])
np.nonzero. This three argument case isn't used nearly as often. Don't feel like you have to understand it well enough to use in your own code. There are other ways of using a boolean mask to set values.