geopandas: index type should be Any
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 2.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 82
Description
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 (https://github.com/pandas-dev/pandas/issues/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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No specific file or test is named. Start by locating the types-geopandas annotations for DataFrame indices and compare them with pandas' current inability to type index kinds; done means the reported IntervalIndex attribute errors are no longer produced when both stub packages are used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100