Skip to content

geopandas: index type should be Any #15111

@adamjstewart

Description

@adamjstewart

My repo currently satisfies pandas-stubs type hints. However, when I add types-geopandas, I see hundreds of new issues:

error: "Index[Any]" has no attribute "overlaps" [attr-defined]
error: "Index[Any]" has no attribute "left" [attr-defined]
error: "Index[Any]" has no attribute "right" [attr-defined]

I'm using pd.IntervalIndex, which has these attributes. However, pandas currently has no way of typing DataFrame indices (pandas-dev/pandas#36708), so there is no way of knowing which kind of index is returned.

I think it would be more correct to use typing.Any here since it is unknown and dynamic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions