Tutorials References Exercises Videos Menu
Free Website Get Certified Upgrade

Pandas DataFrame idxmin() Method

❮ DataFrame Reference


Example

Return the index of the row with the lowest sales, and the index of the row with the lowest age:

import pandas as pd

data = {
  "sales": [23, 34, 56],
  "age": [50, 40, 30]
}

df = pd.DataFrame(data)

print(df.idxmin())
Try it Yourself »

Definition and Usage

The idxmin() method returns a Series with the index of the minimum value for each column.

By specifying the column axis (axis='columns'), the idxmin() method returns a Series with the index of the minimum value for each row.


Syntax

dataframe.idxmin(axis, skipna)

Parameters

The parameters are keyword arguments.

Parameter Value Description
axis 0
1
'index'
'columns'
Optional, Which axis to check, default 0.
skipna True
False
Optional, default True. Specifies whether to skip NULL values or not.

Return Value

A Series with the indexes of the rows/columns with the lowest values.


❮ DataFrame Reference