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

pd.concat with None #857

Closed
amgcc opened this issue Feb 7, 2024 · 6 comments · Fixed by #858
Closed

pd.concat with None #857

amgcc opened this issue Feb 7, 2024 · 6 comments · Fixed by #858
Labels
good first issue Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@amgcc
Copy link
Contributor

amgcc commented Feb 7, 2024

Describe the bug
concat with None values are valid use but pandas-stubs rejects.

To Reproduce

  1. Provide a minimal runnable pandas example that is not properly checked by the stubs.
def x() -> pd.DataFrame:
    df1: pd.DataFrame | None = None
    df2 = pd.DataFrame()
    return pd.concat([df1, df2])
  1. Using mypy
  2. Error
    List item 0 has incompatible type "DataFrame | None"; expected "DataFrame" [list-item]

Please complete the following information:

  • OS: Fedora
  • OS Version 7.8
  • python version 3.11.7
  • version of type checker 1.8.0
  • version of installed pandas-stubs 2.1.1
@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Feb 7, 2024

Thanks for the report. Have to change the Iterable declarations for concat in pandas-stubs/core/reshape/concat.pyi to include None

@Dr-Irv Dr-Irv added good first issue Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Feb 7, 2024
@amgcc
Copy link
Contributor Author

amgcc commented Feb 8, 2024

I tried to push the fix for this but its rejected. Do you need special permissions to submit PRs to this project? I have never tried submitting changes to a public project before.

remote: Permission to pandas-dev/pandas-stubs.git denied to amgcc.
fatal: unable to access 'https://github.com/pandas-dev/pandas-stubs.git/': The requested URL returned error: 403

@bashtage
Copy link
Contributor

bashtage commented Feb 8, 2024

You need to push to your own branch. You should first fork this repo, then clone your fork, make changes, and push your branch to your fork. You can then make a PR from your fork to this repo.

@amgcc
Copy link
Contributor Author

amgcc commented Feb 8, 2024

You need to push to your own branch. You should first fork this repo, then clone your fork, make changes, and push your branch to your fork. You can then make a PR from your fork to this repo.

I tried to clone the repo and create a branch. I'll try this, thanks for the tip.

@amgcc
Copy link
Contributor Author

amgcc commented Feb 9, 2024

Can you tell me if this PR is what you had in mind? If so I can attempt to write a test for it.

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Feb 9, 2024

Can you tell me if this PR is what you had in mind? If so I can attempt to write a test for it.

Yes, that's the right change. You just have to add a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants