Skip to content

ENH: .merge - specify string literals for .merge how keyword #48503

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

Closed
1 of 3 tasks
alexcolemandata opened this issue Sep 11, 2022 · 2 comments · Fixed by #49664
Closed
1 of 3 tasks

ENH: .merge - specify string literals for .merge how keyword #48503

alexcolemandata opened this issue Sep 11, 2022 · 2 comments · Fixed by #49664
Assignees
Labels
Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode Typing type annotations, mypy/pyright type checking

Comments

@alexcolemandata
Copy link

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

The how keyword for DataFrame.merge is typed as a string - which means that type checkers can miss potential errors, as it only accepts a subset of strings ("inner", "outer", "left", "right", "cross").

Feature Description

pandas._typing : add a MergeHow type, specifying the string literals that how accepts

pandas.core.frame: how as accepting an argument of type MergeHow

Alternative Solutions

Alternatively we could specify the string literals in the merge method function header

Additional Context

Related PR for pandas-stubs

@alexcolemandata alexcolemandata added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 11, 2022
@alexcolemandata
Copy link
Author

take

@phofl
Copy link
Member

phofl commented Sep 11, 2022

Hi, thanks for your report. You'll have to add this here and in the stubs repo. Otherwise it won't get picked up by type checkers

@phofl phofl added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Typing type annotations, mypy/pyright type checking and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode Typing type annotations, mypy/pyright type checking
Projects
None yet
2 participants