Skip to content

str + Series -> Never #1359

@zmoon

Description

@zmoon

Example:

import pandas as pd

df = pd.DataFrame({"col": ["b"]})
reveal_type("a" + df["col"])
reveal_type(df["col"] + "c")
df["new"] = "a" + df["col"] + "c"  # mypy error
> mypy t.py
t.py:4: note: Revealed type is "Never"
t.py:5: note: Revealed type is "Never"
t.py:6: error: Unsupported left operand type for + ("Never")  [operator]
Found 1 error in 1 file (checked 1 source file)

Is this like in the discussion in #1355 , a cast is needed now?

pandas 2.3.2
pandas-stubs 2.3.2.250827

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions