Skip to content

pd.concat with names=None #883

Closed
@amgcc

Description

@amgcc

Describe the bug
pd.concat should accept names=None as it is the default value.

To Reproduce

  1. Provide a minimal runnable pandas example that is not properly checked by the stubs.
def maybe_concat(
    dd: dict[str, pd.DataFrame], names: list[str] | None = None
) -> pd.DataFrame:
    """Concatenate a dict of dataframes if available."""
    return pd.concat(dd, names=names) if dd else pd.DataFrame()
  1. Indicate which type checker you are using (mypy or pyright).
    mypy
  2. Show the error message received from that type checker while checking your example.
error: Argument "names" to "concat" has incompatible type "list[str] | None"; expected "list[str]"  [arg-type]

Please complete the following information:

  • OS: [e.g. Windows, Linux, MacOS] Linux
  • OS Version [e.g. 22] Fedora 7
  • python version 3.11.8
  • version of type checker 1.8.0
  • version of installed pandas-stubs 2.1.4

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions