Get nsmallest values from a particular column in Pandas DataFrame (original) (raw)

Last Updated : 03 Oct, 2025

nsmallest() function returns the top n rows with the smallest values in the specified column(s).

Syntax:

DataFrame.nsmallest(n, columns, keep='first')

**Parameters:

To download the dataset used in this article, click here

Loading the Dataset

Python `

import pandas as pd df = pd.read_csv(r'enter the path to dataset here')

df.head(10)

`

**Explanation:

Example 1: Find the 5 Youngest Players (Smallest Ages)

Python `

df.nsmallest(5, ['Age'])

`

**Output

Example 2: Find the 10 Lightest Players (Smallest Weights)

Python `

df.nsmallest(10, ['Weight'])

`

**Output

Example 3: Getting the 5 smallest Rows by Age and Weight Together

Python `

df.nsmallest(5, ['Age', 'Weight'])

`

**Output

smallest_age_weight