Working with pandas: merging, apply, and groupby

Abstract

This notebook demonstrates how to combine and manipulate tabular data with pandas.
It covers the most commonly used methods for joining DataFrames (merge), applying functions to columns (apply), and grouping data (groupby).
All examples use synthetic data created directly within the notebook for demonstration purposes.

Learning goals
After completing this notebook, you will be able to:

  • Merge pandas DataFrames using different join types (leftrightinnerouter)
  • Apply custom functions to DataFrames or columns using apply
  • Aggregate and summarize data with groupby
  • Understand how missing values (NaN) are introduced and handled during merging
  • Interpret merge results and debug mismatched keys