min()
df.groupby(column_name).min()
Returns a DataFrame, with rows as groups, and each column as the min of the column values within each group.
- Note:
- Columns with String values display the minimum alphabetical starting character (ex.
"black"
is alphabetically before"golden"
and"white"
).
pets
Index | Species | Color | Weight | Age |
---|---|---|---|---|
0 | dog | black | 40 | 5 |
1 | cat | golden | 15 | 8 |
2 | cat | black | 20 | 9 |
3 | dog | white | 80 | 2 |
4 | dog | black | 25 | 0.5 |
5 | hamster | black | 1 | 3 |
6 | hamster | golden | 0.25 | 0.2 |
pets.groupby('Species').min()
Index | ID | Color | Weight | Age | Is_Cat | Owner_Comment |
---|---|---|---|---|---|---|
cat | cat_001 | black | 1.5 | 0 | True | ****All you need is love and a cat.**** |
dog | dog_001 | black | 25 | 0.5 | False | There are no bad dogs, only bad owners. |
hamster | ham_001 | black | 0.25 | 0.2 | False | No, thank you! |