Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
idxmax Return the row label of the maximum value.
argmax: Return int position of the largest value in the Series.
In [2]:
import pandas as pd
In [3]:
s = pd.Series(
data=[1, None, 4, 3, 4],
index=['A', 'B', 'C', 'D', 'E']
)
s
Out[3]:
In [4]:
s.idxmax()
Out[4]:
In [5]:
s.argmax()
Out[5]:
In [ ]:
## References
https://pandas.pydata.org/docs/reference/api/pandas.Series.idxmax.html
https://pandas.pydata.org/docs/reference/api/pandas.Series.argmax.html
Can I use idxmax() instead of argmax() in all cases?
https://stackoverflow.com/questions/47596390/can-i-use-idxmax-instead-of-argmax-in-all-cases