implementing np.where not returning expected indices when using boolean conditions
I'm relatively new to this, so bear with me. Quick question that's been bugging me - I'm working with an unexpected behavior when using `np.where` with a boolean condition on a 2D NumPy array... I have a 2D array representing temperature data collected from various sensors, and I want to find the indices where the temperature exceeds a certain threshold. Here's a minimal example of what I'm trying to achieve: ```python import numpy as np temp_data = np.array([[22, 25, 18], [30, 32, 29], [15, 20, 23]]) threshold = 24 indices = np.where(temp_data > threshold) print(indices) ``` I expected the output to provide a tuple of arrays corresponding to the row and column indices of the temperature readings that exceed 24. However, I'm getting: ``` (array([1, 1, 2]), array([0, 1, 2])) ``` This output indicates that the conditions are met, but I am confused as to why the last index pair (2, 2) corresponds to a value of 23, which does not exceed the threshold. I've double-checked the condition and the values of the `temp_data` array, and everything seems correct. I've also tried using `temp_data[temp_data > threshold]` to see if I can directly retrieve the values, which correctly returns: ``` array([30, 32, 29]) ``` This works as expected, so I'm wondering what might be causing the confusion with the `np.where` output. Is there something I'm missing regarding how `np.where` evaluates the condition, or is there a specific feature of NumPy that I should be aware of that could explain this behavior? I'm using NumPy version 1.21.0, so if there are any known issues or changes in behavior in that version, Iād appreciate any insights. This is part of a larger web app I'm building. Is there a better approach? Am I missing something obvious? Could someone point me to the right documentation? I'm coming from a different tech stack and learning Python. Thanks for any help you can provide!