Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pd.RangeIndex should accept range as the first argument #677

Closed
Daverball opened this issue May 3, 2023 · 2 comments · Fixed by #1005
Closed

pd.RangeIndex should accept range as the first argument #677

Daverball opened this issue May 3, 2023 · 2 comments · Fixed by #1005
Labels
good first issue Index Related to the Index class or subclasses

Comments

@Daverball
Copy link
Contributor

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
@twoertwein
Copy link
Member

Would need to add range here

start: int | RangeIndex = ...,
(and probably also for __new__)

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented May 5, 2023

(and probably also for __new__)

We actually don't need __new__() here, so we should delete it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Index Related to the Index class or subclasses
Projects
None yet
3 participants