Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas-stubs/core/indexes/range.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from pandas._typing import (
class RangeIndex(Index[int]):
def __new__(
cls,
start: int | RangeIndex = ...,
start: int | RangeIndex | range = ...,
stop: int = ...,
step: int = ...,
dtype=...,
Expand All @@ -24,7 +24,7 @@ class RangeIndex(Index[int]):
): ...
def __init__(
self,
start: int | RangeIndex = ...,
start: int | RangeIndex | range = ...,
stop: int = ...,
step: int = ...,
dtype=...,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,12 @@ def test_getitem() -> None:
check(assert_type(i0[[0, 2]], "pd.Index[str]"), pd.Index, str)


def test_range_index_range() -> None:
"""Test that pd.RangeIndex can be initialized from range."""
iri = pd.RangeIndex(range(5))
check(assert_type(iri, pd.RangeIndex), pd.RangeIndex, int)


def test_multiindex_dtypes():
# GH-597
mi = pd.MultiIndex.from_tuples([(1, 2.0), (2, 3.0)], names=["foo", "bar"])
Expand Down
Loading