Skip to content

TYP: widen duplicated() input type to AnyArrayLike (GH 42604)#65699

Open
gkneighb wants to merge 1 commit into
pandas-dev:mainfrom
gkneighb:typ-duplicated-anyarraylike
Open

TYP: widen duplicated() input type to AnyArrayLike (GH 42604)#65699
gkneighb wants to merge 1 commit into
pandas-dev:mainfrom
gkneighb:typ-duplicated-anyarraylike

Conversation

@gkneighb
Copy link
Copy Markdown

Summary

pandas.core.algorithms.duplicated() already accepts Series and Index at runtime (its internal call to _ensure_data unwraps them via extract_array), and its user-facing docs reflected this since #41985. Only the type annotation and docstring lagged behind. This widens both duplicated() and _ensure_data() from ArrayLike to AnyArrayLike (which adds Index | Series) and updates the parameter docstrings to match.

Widening a parameter type is backward-compatible — existing callers passing ArrayLike continue to type-check unchanged.

Note

This PR was developed with AI assistance (Claude); the agent was given AGENTS.md as guidance.

Co-Authored-By: Claude Opus 4.7 (1M context) <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.

TYP: Improve typing on pandas.core.algorithms.duplicated()

1 participant