Skip to content

s.str.upper doesn't preserve s type #1149

Open
@MarcoGorelli

Description

@MarcoGorelli
import pandas as pd

s: "pd.Series[str]" = pd.Series(['a', 'b'])
reveal_type(s)  # information: Type of "s" is "Series[str]"
reveal_type(s.str.upper())  # information: Type of "s.str.upper()" is "Series[Unknown]"

The reason I'm reporting this is that the source code uses a TypeVar, so the intention might have been that the type be preserved?

def upper(self) -> T: ...

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