Contribute Media
A thank you to everyone who makes this possible: Read More

When should I use a "groupby" in pandas?

Description

The pandas "groupby" method allows you to split a DataFrame into groups, apply a function to each group independently, and then combine the results back together. This is called the "split-apply-combine" pattern, and is a powerful tool for analyzing data across different categories. In this video, I'll explain when you should use a groupby and then demonstrate its flexibility using four different examples.

This is video 14 of 30 in the series, Easier data analysis in Python with pandas. The notebook and datasets shown in the video are available on GitHub.

Improve this page