Articles → Pandas → Idxmax Function In Pandas

Idxmax Function In Pandas






Purpose





Example


import pandas as pd

df = pd.DataFrame({"A": [4, 5, 2, 6], "B": [11, 2, 5, 8], "C": [1, 8, 66, 4]})

df.idxmax()




  1. In the first row, 6 is the maximum number and its index is 3.
  2. In the second row, 11 is the maximum number and its index is 0.
  3. In the third row, 66 is the maximum number and its index is 2.

Output


Picture showing the output of idxmax function in pandas

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, May 16, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250