Skip to content

BUG: DataFrame.insert value is too strict #529

Closed
@phofl

Description

@phofl

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions