From the course: pandas Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Groupby

Groupby - pandas Tutorial

From the course: pandas Essential Training

Start my 1-month free trial

Groupby

- [Instructor] Groupby is one of the most important functionalities available in Pandas. Groupby does three things. It splits a DataFrame into groups based on some criteria, it applies a function to each group independently and it combines the results into a DataFrame. Now, many people when they first learn how to use the Groupby function, don't know what to do with the Groupby object. Creating the Groupby object only verifies that you've passed a valid mapping. The Groupby object isn't a DataFrame but rather a group of DataFrames in a dict-like structure. On the next slide, we have a useful visualization that helps us show what the Groupby function does. So, Groupby splits the DataFrame into groups. Each of these groups remember is a DataFrame, it applies a function for each group and then finally it combines the results into a DataFrame. Let's head over to the Jupyter Notebook to look at a couple of examples. So, let's import Pandas as PD. We read the Olympic CSV file into our…

Contents