GroupBy—The groupby() method

Understand and apply the basic capabilities of the groupby() method.

Overview of groupby()

The groupby() method is a powerful and versatile method that allows us to group rows or columns together based on the criteria we define. It’s often used with aggregate functions (e.g., sum, average, etc.) or transformation functions (e.g., normalization) to summarize results across one or more columns.

The groupby() method is commonly used in real-world data analysis because it helps us create useful high-level data summaries. For example, a bank may want to determine the customers’ average account balances over the last three months. A groupby() operation with a mean aggregation will give us the answer needed.

Get hands-on with 1200+ tech skills courses.