0

sorry for very basic question but i can't find a direct answer.

I want to check a column to find the maximum value. for now I assume there is only one maximum value, its unique.

I then want to find the index name for that row.

Is there a way to do this?

jpp
  • 159,742
  • 34
  • 281
  • 339
ZakS
  • 1,073
  • 3
  • 15
  • 27
  • 1
    Thank you for accepting my answer @ZakS :) but for your next question, if you cannot seem to find an answer on this site, try to search for it in a different formulation, or learn more on the topic, as in 99.99% of the time, the questions you (or any newcomer to the pandas module) have, already have an answer :) Happy coding ! – Jacquot Apr 12 '18 at 14:32

1 Answers1

0

Just df.index[df[your_column_name].argmax()] :)

Jacquot
  • 1,750
  • 15
  • 25
  • 1
    While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value. – Maximilian Peters Apr 09 '18 at 15:38
  • 1
    yeah @MaximilianPeters you're right. But if I have to be honest with myself, this question is obviously a duplicate. better to close it rather than me trying to rewrite the original answer without copy-pasting – Jacquot Apr 12 '18 at 14:36