Python Practice › Pandas Programs › Program 28
Index of smallest and largest
Write a pandas program to find the index of the smallest and largest values.
Input
[54, 25, 38, 87]
Output
1 3
Approach
idxmin()andidxmax().
Solution
import pandas as pds = pd.Series([54, 25, 38, 87])print(s.idxmin(), s.idxmax())Output
1 3
Learn the concept
New to this topic? Read the lesson, then come back.