TYP: widen duplicated() input type to AnyArrayLike (GH 42604)#65699
Open
gkneighb wants to merge 1 commit into
Open
TYP: widen duplicated() input type to AnyArrayLike (GH 42604)#65699gkneighb wants to merge 1 commit into
gkneighb wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_algos.pyand Seriesduplicated/drop_duplicatescontinue to pass)doc/source/whatsnew/vX.X.X.rstfile — omitted, following the convention of recent internal TYP PRs (e.g. TYP: typing for IndexSlice #65465, TYP: fix frame apply reduction typing #65555, TYP: type-check pandas.core.sample #65533, TYP: annotate pandas/_config/config.py #65549) which did not add whatsnew entries.AGENTS.md.Summary
pandas.core.algorithms.duplicated()already acceptsSeriesandIndexat runtime (its internal call to_ensure_dataunwraps them viaextract_array), and its user-facing docs reflected this since #41985. Only the type annotation and docstring lagged behind. This widens bothduplicated()and_ensure_data()fromArrayLiketoAnyArrayLike(which addsIndex | Series) and updates the parameter docstrings to match.Widening a parameter type is backward-compatible — existing callers passing
ArrayLikecontinue to type-check unchanged.Note
This PR was developed with AI assistance (Claude); the agent was given
AGENTS.mdas guidance.