Skip to content

TYP: Add typing.overload signatures to DataFrame.drop_duplicates. #54281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2023
Merged

TYP: Add typing.overload signatures to DataFrame.drop_duplicates. #54281

merged 2 commits into from
Jul 28, 2023

Conversation

rchen152
Copy link
Contributor

This adds overloads so that a type checker can determine whether drop_duplicates returns DataFrame or None based on the value of the inplace argument.

The motivation for this is that we're using a type checker that looks at the pandas source code for type information. I realize that we should be using the stubs instead, but this will unblock us in the meantime and seems like an improvement to the type annotations anyway.

rchen152 added 2 commits July 27, 2023 14:35
This adds overloads so that a type checker can determine whether
drop_duplicates returns DataFrame or None based on the value of the
`inplace` argument.
@twoertwein twoertwein added the Typing type annotations, mypy/pyright type checking label Jul 28, 2023
@twoertwein twoertwein merged commit ed25532 into pandas-dev:main Jul 28, 2023
@twoertwein
Copy link
Member

Thank you @rchen152!

@rchen152 rchen152 deleted the drop_duplicates_overloads branch July 28, 2023 18:21
@rchen152
Copy link
Contributor Author

Thanks for the quick review and merge :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants