pandas-stubs
pandas-stubs copied to clipboard
`pd.RangeIndex` should accept `range` as the first argument
Describe the bug
Both according to the docs and the implementation it is valid to pass a python range object as the first argument to pd.RangeIndex
To Reproduce
import pandas as pd
pd.RangeIndex(range(5)) # mypy: arg-type – Argument 1 to "RangeIndex" has incompatible type "range"
Please complete the following information:
- OS: Linux (OpenSUSE Tumbleweed)
- Python 3.10
- mypy 1.0.1
- pandas-stubs 2.0.1.230501
Would need to add range here https://github.com/pandas-dev/pandas-stubs/blob/9c301b33b746e28401868b788364cecd00a34655/pandas-stubs/core/indexes/range.pyi#L30 (and probably also for __new__)
(and probably also for
__new__)
We actually don't need __new__() here, so we should delete it.