Skip to content

BUG: DataFrame.insert value is too strict #529

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
phofl opened this issue Feb 7, 2023 · 1 comment · Fixed by #543
Closed

BUG: DataFrame.insert value is too strict #529

phofl opened this issue Feb 7, 2023 · 1 comment · Fixed by #543

Comments

@phofl
Copy link
Member

phofl commented Feb 7, 2023

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

  1. Provide a minimal runnable pandas example that is not properly checked by the stubs.
  2. Indicate which type checker you are using (mypy or pyright).
  3. Show the error message received from that type checker while checking your example.
df = DataFrame({"a": [1, 2]})
df.insert(loc=0, column="b", value=None)
error: Value of type variable "ListLike" of "insert" of "DataFrame" cannot be "None"  [type-var]

Please complete the following information:

  • OS: [e.g. Windows, Linux, MacOS] MacOS
  • OS Version [e.g. 22] Venturar 13.1
  • python version 3.10
  • version of type checker mypy 0.991
  • version of installed pandas-stubs latest

Additional context
Add any other context about the problem here.

According to the main repo, any Scalar is allowed

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Feb 7, 2023

Need to change

value: int | ListLike,

to be value: Scalar | ListLikeU | None with appropriate tests.

Dr-Irv pushed a commit that referenced this issue Feb 19, 2023
* Update test_frame.py

* Update frame.pyi

* Update test_frame.py

* Changed assert_type

* Update test_frame.py

* Update test_frame.py
twoertwein pushed a commit to twoertwein/pandas-stubs that referenced this issue Apr 1, 2023
* Update test_frame.py

* Update frame.pyi

* Update test_frame.py

* Changed assert_type

* Update test_frame.py

* Update test_frame.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants