Skip to main content

max()

df.groupby(column_name).max()

Returns a DataFrame, with rows as groups, and each column as the max of the column values within each group.

Note:
Columns with String values display the maximum alphabetical starting character (ex. "white" is alphabetically after "black" and "golden").

pets
IndexSpeciesColorWeightAge
0dogblack405
1catgolden158
2catblack209
3dogwhite802
4dogblack250.5
5hamsterblack13
6hamstergolden0.250.2
pets.groupby('Species').max()
IndexIDColorWeightAgeIs_CatOwner_Comment
catcat_003golden159TrueNo, thank you!
dogdog_003white805FalseLove is a wet nose and a wagging tail.
hamsterham_002golden13FalseNo, thank you!