Closed
Description
Describe the bug
pd.concat
should accept names=None
as it is the default value.
To Reproduce
- 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()
- Indicate which type checker you are using (
mypy
orpyright
).
mypy - 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