Skip to content

T.loc[] does not return a T-like type #1287

@OrangeDog

Description

@OrangeDog

I'm using IDEA/PyCharm for type checking, but from looking at the stubs this does seem to be an omission there.

I would expect "slicing" a Series or DataFrame to return something with all the same methods as a Series or DataFrame, but the types do not appear to be that.

pd.Series(range(4)).loc[2:].sum()

The above, for example, correctly evaluates to 5, but generates the warning:

Unresolved attribute reference 'sum' for class '_LocIndexerSeries'

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