Skip to content

Fix FutureWarning: pass include_groups=False to groupby().apply()#182

Open
BelixRogner wants to merge 1 commit intocrowdcent:masterfrom
BelixRogner:fix/groupby-apply-future-warning
Open

Fix FutureWarning: pass include_groups=False to groupby().apply()#182
BelixRogner wants to merge 1 commit intocrowdcent:masterfrom
BelixRogner:fix/groupby-apply-future-warning

Conversation

@BelixRogner
Copy link
Contributor

Summary

  • Add include_groups=False to all groupby().apply() calls to fix the FutureWarning introduced in pandas 2.2
  • Fixes two call sites in numerblox/evaluation.py (lines 148, 209) and one in numerblox/postprocessing.py (line 186)
  • Prepares for pandas 3.0 where the default behavior will change to exclude grouping columns

Details

Starting with pandas 2.2, groupby().apply() emits a FutureWarning when the grouping columns are included in the DataFrame passed to the applied function. The include_groups=False parameter explicitly opts into the future behavior, silencing the warning without changing functionality since the lambdas already select specific columns.

🤖 Generated with Claude Code

Starting with pandas 2.2, groupby().apply() emits a FutureWarning when
the grouping columns are included in the passed DataFrame. Add
include_groups=False to all three call sites (two in evaluation.py,
one in postprocessing.py) to silence the warning and prepare for
pandas 3.0 where the default will change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants