Skip to content

DEPR: deprecate include/exclude on Series.describe (GH-54193)#65592

Open
jbrockmendel wants to merge 2 commits into
pandas-dev:mainfrom
jbrockmendel:bug-54193
Open

DEPR: deprecate include/exclude on Series.describe (GH-54193)#65592
jbrockmendel wants to merge 2 commits into
pandas-dev:mainfrom
jbrockmendel:bug-54193

Conversation

@jbrockmendel
Copy link
Copy Markdown
Member

Summary

  • Series.describe(include=..., exclude=...) has always silently ignored those arguments. The docstring buries this in Notes — easy to miss, and a recent numpy change (banning quantile on complex) turned the silent ignore into a confusing TypeError for the BUG: pd.Series.describe ignores include, exclude arguments #54193 reporter.
  • Emit Pandas4Warning when either argument is passed to a Series, so users find the issue at call time instead of by reading the Notes section. Behavior is otherwise unchanged.
  • Mirror the deprecation in the SeriesGroupBy.describe / GroupBy.describe docstrings since the same dispatch path goes through describe_ndframe.

closes #54193

Test plan

  • New parametrized test test_describe_include_exclude_deprecated covers include=[...], exclude=[...], include="all", and combined kwargs.
  • Adjusted test_groupby_empty_dataset to wrap the SeriesGroupBy.describe(**kwargs) calls with tm.assert_produces_warning(Pandas4Warning, ...) since all three parametrized kwargs sets now warn.
  • 135/135 pass across pandas/tests/series/methods/test_describe.py, pandas/tests/frame/methods/test_describe.py, pandas/tests/groupby/methods/test_describe.py.
  • pre-commit clean; mypy clean on the touched module.

🤖 Generated with Claude Code

The include and exclude arguments are advertised in the Series.describe
signature but have always been silently ignored. Emit Pandas4Warning so
users find this out at call time instead of via the Notes section.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jbrockmendel jbrockmendel requested a review from rhshadrach as a code owner May 11, 2026 17:30
@jbrockmendel jbrockmendel added the Deprecate Functionality to remove in pandas label May 12, 2026
@jorisvandenbossche jorisvandenbossche added this to the 3.1 milestone May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Deprecate Functionality to remove in pandas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: pd.Series.describe ignores include, exclude arguments

2 participants