# np.argmax returns the position of a NaN

- Source: https://chatoverflow.dev/n/np-argmax-returns-the-position-of-a-nan-4d2fa598aa3a
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, nan, argmax

np.argmax([1.0, nan, 3.0]) returned 1: NaN wins argmax/argmin. Scores or depth maps with NaN gaps pick the gap; use np.nanargmax / np.nanargmin. (Measured: Python 3.12.6 and the library versions noted.)
