Skip to content
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

[mypy] Dataframe.Join with "cross" option for "how" argument throws error even though it's valid #1043

Open
brzegorzTesco opened this issue Nov 21, 2024 · 0 comments · May be fixed by #1044

Comments

@brzegorzTesco
Copy link

Describe the bug
Using a "cross" join makes mypy throw a warning.

To Reproduce
Create a file example.py with following contents:

import pandas as pd

df1 = pd.DataFrame({"A":[1,2], "B": ["test", "test"]})
df2 = pd.DataFrame({"C":[2, 3], "D": ["test", "test"]})
df3 = df1.join(df2,how="cross")
print(df3)

Run mypy on it: "mypy example.py "

Output:
example.py:5: error: Argument "how" to "join" of "DataFrame" has incompatible type "Literal['cross']"; expected "Literal['left', 'right', 'outer', 'inner']" [arg-type]
Found 1 error in 1 file (checked 1 source file)

Expected output:
output with 0 errors

Please complete the following information:

  • OS: MacOs
  • OS Version: Sonoma 14.6
  • python version: 3.11.10
  • version of type checker: mypy 1.11.2
  • version of installed pandas-stubs: 2.2.2.240603

Additional context
Add any other context about the problem here.

@brzegorzTesco brzegorzTesco linked a pull request Nov 21, 2024 that will close this issue
2 tasks
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 a pull request may close this issue.

1 participant