Skip to content

Bug in 1.2.0 - No matching overload found - probably regression #4413

Description

@gothicVI

Describe the Bug

MWN:

import pandas as pd

df = pd.DataFrame()
rows: list[pd.DataFrame] = [pd.DataFrame()]

# Fails
pd.concat([df, *rows], axis="index", ignore_index=True)

# Passes
tmp: list[pd.DataFrame] = [df, *rows]
pd.concat(tmp, axis="index", ignore_index=True)

The version that now fails used to work in 1.1.1 but now fails with something like

ERROR No matching overload found for function `pandas.core.reshape.concat.concat` called with arguments: (list[DataFrame], axis=Literal['index'], ignore_index=Literal[True]) [no-matching-overload]
  Possible overloads:
    (objs: Iterable[None] | Mapping[HashableT1, None], *, axis: Axis = 0, ..., ignore_index: bool = False, ...) -> Never [closest match]
    (objs: Iterable[NDFrame | None] | Mapping[HashableT1, NDFrame | None], *, axis: Axis = 0, ..., ignore_index: Literal[True], ...) -> Never
    (objs: Iterable[Series[S2] | None] | Mapping[HashableT1, Series[S2] | None], *, axis: AxisIndex = 0, ..., ignore_index: bool = False, ...) -> Series[S2]
    (objs: Iterable[Series | None] | Mapping[HashableT1, Series | None], *, axis: AxisIndex = 0, ..., ignore_index: bool = False, ...) -> Series
    (objs: Iterable[Series | None] | Mapping[HashableT1, Series | None], *, axis: AxisColumn, ..., ignore_index: bool = False, ...) -> DataFrame
    (objs: Iterable[DataFrameT0 | None] | Mapping[HashableT1, DataFrameT0 | None], *, axis: Axis = 0, ..., ignore_index: bool = False, ...) -> DataFrameT0
    (objs: Iterable[NDFrame | None] | Mapping[HashableT1, NDFrame | None], *, axis: Axis = 0, ..., ignore_index: Literal[False] = False, ...) -> DataFrame
  Argument `list[DataFrame]` is not assignable to parameter `objs` with type `Iterable[None] | Mapping[@_, None]` in function `pandas.core.reshape.concat.concat`

Sandbox fails with

ERROR sandbox.py:1:8-20: Stubs for `pandas` are bundled with Pyrefly but the source files for the package are not found. [[missing-source-for-stubs](https://pyrefly.org/en/docs/error-kinds/#missing-source-for-stubs)]

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions