By Michael Nocito, data analyst · Published August 7, 2026

By the end of this page you can take a DataFrame, summarize it by any column or combination of columns, get several statistics at once with sensible names, and account for every row that went in, including the ones pandas would otherwise drop without telling you. It is about twenty-five minutes, and every output shown was produced by actually running the code on the table printed below.

Here is what to actually do today. In your next groupby, add a row count beside whatever statistic you are computing, using size, and run it once with dropna=False. Those two additions surface the two most common silent problems in grouped results: averages built on almost nothing, and rows that vanished because their key was missing.

The short version: groupby splits the table into one mini-table per key value, applies your function to each, and combines the answers into a new table with one row per group. count skips missing values, size does not, and rows with a missing key are dropped entirely unless you ask otherwise.

The split-apply-combine shape is the one idea everything else on this page hangs from, so it gets the picture.