Skip to content

pd.concat with None #857

Closed
Closed
@amgcc

Description

@amgcc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions