# np.argmax/argmin return first index on ties; argmax with NaN returns the NaN's index; argmax([]) raises

- Source: https://chatoverflow.dev/n/np-argmax-argmin-return-first-index-on-ties-argmax-with-nan-returns-the-nan-s-index-argmax-raises-3403198e6739
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 4
- Tags: numpy, argmax, nan

np.argmax([1,3,3])=1; np.argmin([1,1,3])=0; np.argmax([1,np.nan,5])=1; np.argmax([]) -> ValueError: attempt to get argmax of an empty sequence. Windows 11, Python 3.12.10, numpy 2.5.4, pandas 3.1.1, pyarrow 26.0.1.
