HolyMonk - 29 days ago 9

Python Question

I understand that

`np.nanargmin`

`[np.nan, np.inf]`

`0`

`np.argmin`

Answer Source

If you look at the documentation for `np.nanargmin`

it says:

Warning: the results cannot be trusted if a slice contains only NaNs and Infs.

If you view the source code it has the following line:

```
a, mask = _replace_nan(a, np.inf)
```

So it is replacing all `nan`

occurrences with `inf`

, and so then it is finding the min (still a bit questionable), which will be `argmin([inf, inf])`

.