Skip to content
Advertisement

How to find the row having the minimum values in a given pandas dataframe?

I have created a dataframe using the following code.

JavaScript

Then I found the minimum values of each row by using

JavaScript

It gave me the minimum value of each column, but I also want to find out that at which index the min value is available for each column. Please give a sutiable solution for finding the index of the min value of each column. Dataset in this repo

Advertisement

Answer

First, you have to fix your data. You have -- as value for the cell (347, Himachal Pradesh) then you can use idxmin as suggested:

JavaScript

Output:

JavaScript

Note: it’s really curious but the min for each column is the row 388. Try to use idxmax to see the difference.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement