You can try one of the following approaches to find min and max values in a column of a Pandas dataframe:
Approach 1
>>> import pandas as pd>>> df1 = pd.DataFrame({'Name':['abc','def','ghi','jkl'], 'Age':[42,23,12,60], 'income':[1200,200,3000,2800]})>>> df1 Name Age income0 abc 42 12001 def 23 2002 ghi 12 30003 jkl 60 2800>>> df1[df1['Age']==df1['Age'].max()] Name Age income3 jkl 60 2800>>> df1[df1['Age']==df1['Age'].min()] Name Age income2 ghi 12 3000
Approach 2
>>> df1.sort_values(['Age'], ascending=False).head(1) Name Age income3 jkl 60 2800>>> df1.sort_values(['Age'], ascending=True).head(1) Name Age income2 ghi 12 3000