I am new to python and numpy. I have written code to teach myself. However, I cannot comprehend how the below code produces its result.
Input
np.where([[True, False], [True, True]],
[[1, 2], [3, 4]], [[9, 8], [7, 6]])
Output
array([[1, 8],
[3, 4]])
I do not understand how this result is achieved.
help(np.where)will explain that this takes elements from x ([[1,2],[3,4]) where condition isTrue, and elements from y elsewhere, in this case, theFalsecondition is returning the8value fromy.helpdox.