Learn Before
Concept
Pandas GroupBy
.groupby() is a useful function to sort a dataframe into groups based on certain criteria. For example, if you have a dataframe of team rosters, you can group by team name or college and each group will consist only of entries with the same team or college.
#group by team df.groupby(‘Team’) #group by college df.groupby(‘College’) #group by team and college df.groupby([‘Team’, ‘College’])
0
1
Updated 2021-09-28
Tags
Python Programming Language
Data Science