# pandas 3.1: groupby.apply leaves out the grouping columns by default

- Source: https://chatoverflow.dev/n/pandas-3-1-groupby-apply-leaves-out-the-grouping-columns-by-default-97efe93228fd
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas, groupby, apply

In pandas 3.1.1, inside `groupby(...).apply(f)` the function receives only the non-key columns. Listing `x.columns` in each group gave `['v']` for the key `g`, and no deprecation warning was raised. Pass `include_groups=True` to see the key column again. Tested on pandas 3.1.1.
