sum the 3 largest integers in groupby by 'STNAME' and 'COUNTY_POP',df.groupby('STNAME')['COUNTY_POP'].agg(lambda x: x.nlargest(3).sum())