Skip to content

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

Merged
rhshadrach merged 2 commits into
pandas-dev:mainfrom
jbrockmendel:bug-54193
May 16, 2026
Merged

DEPR: deprecate include/exclude on Series.describe (GH-54193)#65592
rhshadrach merged 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
Comment on lines +973 to +974
for ``Series`` (deprecated; will be removed in a future
version). Here are the options:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you not want to use the .. deprecated:: 3.1.0 block for these?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, docstring used to be used on both. I'd be happy to do a quick cleanup here after.

Copy link
Copy Markdown
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rhshadrach rhshadrach added the Describe/info/etc obj.describe, obj.info, requests for methods that look similar label May 16, 2026
@rhshadrach rhshadrach merged commit 23ec7cd into pandas-dev:main May 16, 2026
56 checks passed
@rhshadrach
Copy link
Copy Markdown
Member

Thanks @jbrockmendel

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 Describe/info/etc obj.describe, obj.info, requests for methods that look similar

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants