Skip to content

pandas .loc should accept an Index as the argument #62

@Dr-Irv

Description

@Dr-Irv

The following works:

import pandas as pd

df = pd.DataFrame({"x": [1, 2, 3]}, index=pd.Index(["a", "b", "c"]))

index = pd.Index(["b"])

df2 = df.loc[index]

print(df2)

but pylance 2021.5.3 reports for the line with the .loc:

No overloads for "__getitem__" match the provided arguments
  Argument types: (Index[str])

PR to follow

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