Pandas Index Max | pd.DataFrame.idxmax()

preview_player
Показать описание


Pandas idxmax is a very convenient function that will return the index of the maximum value across a specified axis. It is especially useful when trying to figure out the max column values for your rows OR maximum row value for your columns.

Say you have a list of students as your rows, and test scores in your columns. Which test was the highest for each student? .idxmax() is a one-liner that'll tell you.

Рекомендации по теме
Комментарии
Автор

Great, that's just what I needed.

barretthooper
Автор

Great, Thank you. but i got an error like "reduction operation 'argmax' not allowed for this type", when I use a different dataframe.
i don't know what is it. can you help me with it

jeevakumara