Finding indexes with `np.where(condition)` or `np.asarray(condition).nonzero()`

Throughout the repo, we use `np.where(condition)` for getting indexes, for instance in [SelectorMixin.get_support()](https://github.com/scikit-learn/scikit-learn/blob/fba028b07ed2b4e52dd3719dad0d990837bde28c/sklearn/feature_selection/_base.py#L73), in [SimpleImputer.transform()](https://github.com/scikit-learn/scikit-learn/blob/fba028b07ed2b4e52dd3719dad0d990837bde28c/sklearn/impute/_base.py#L670) and in several of our examples ([example](https://github.com/scikit-learn/scikit-learn/blob/fba028b07ed2b4e52dd3719dad0d990837bde28c/examples/linear_model/plot_sgd_iris.py#L58)).

The numpy documentation [discourages](https://numpy.org/doc/2.1/reference/generated/numpy.where.html) the use of `np.where` with just passing a condition and recommends `np.asarray(condition).nonzero()` instead.

For cleanliness of code, should we adopt this recommendation, at least in the examples? Or are there good reasons why we do that?

COMMENT:
The reason why `np.where(condition)` is discouraged is documented as follows:

> Using [nonzero](https://numpy.org/doc/2.1/reference/generated/numpy.nonzero.html#numpy.nonzero) directly should be preferred, as it behaves correctly for subclasses.

I don't recall any issue reported by users using scikit-learn with subclasses of NumPy arrays and having problems as a result. I am not even sure what "behaves correctly" means in that context: returning a NumPy array of integer indices or a subclass instance storing the same indices? For our use cases, I think returning a NumPy array (not subclassing) is perfectly fine, but any option might work.

Let's try:

```python
>>> import numpy as np
>>> class my_array(np.ndarray):
...     pass
... 
>>> condition = np.asarray([True, False, False, True, True]).view(my_array)
>>> condition
my_array([ True, False, False,  True,  True])
>>> np.where(condition)[0]
array([0, 3, 4])
>>> condition.nonzero()[0]
array([0, 3, 4])
>>> np.nonzero(condition)[0]
array([0, 3, 4])
```

So I don't see any difference: neither returns an instance of the `my_array` subclass.

I traced this recommendation in the doc to this PR by @eric-wieser: https://github.com/numpy/numpy/pull/11425
  
However, whenever we convert a scikit-learn estimator to add array API support, the `xp.where` prototype in the spec implies that the second and third argument are not optional (contrary to calling `np.where` with a single `condition` argument):

https://data-apis.org/array-api/latest/API_specification/generated/array_api.where.html#where

Since `nonzero` is also part of the array API, I think it would make sense to use `xp.nonzero` instead when we convert code to add array API support:

https://data-apis.org/array-api/latest/API_specification/generated/array_api.nonzero.html#nonzero

Apart from adding array API support, I would rather not change the code unless we identify a good reason to do it (in particular if we identify a user-facing impact). Personally, I am not convinced that one is particularly more readable than the other.

That being said, I would be curious to understand better why `np.where(condition)` is discouraged in the first place: it's not clear from the NumPy doc and my quick experiment above failed to clarify the issue.

Labels: good first issue