Locked lesson.
About this lesson
The groupby function allows us to group different pieces of data together. We'll discuss the function in this video.
Exercise files
Download this lesson’s related exercise files.
Groupby Grouping Data.docx57.2 KB Groupby Grouping Data - Solution.docx
55.5 KB
Quick reference
Groupby Grouping Data
The .groupby() function allows us to group data in our DataFrame together.
When to use
Use .groupby() whenver you want to group data together in any given way.
Instructions
To group data in a DataFrame by a certain column:
variable = df.groupby('Column')
Once grouped, we can run universal functions such as max, min, mean, std, var, sum, describe, etc.
variable.sum()
variable.min()
variable.max()
variable.mean()
variable.var()
variable.std()
variable.describe()
Hints & tips
- df.groupby('Column')
Lesson notes are only available for subscribers.