Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 1 addition & 10 deletions pandas-stubs/core/indexes/range.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,13 @@ from pandas._typing import (
class RangeIndex(Index[int]):
def __new__(
cls,
start: int | RangeIndex = ...,
start: int | RangeIndex | range = ...,
stop: int = ...,
step: int = ...,
dtype=...,
copy: bool = ...,
name=...,
): ...
def __init__(
self,
start: int | RangeIndex = ...,
stop: int = ...,
step: int = ...,
dtype=...,
copy: bool = ...,
name=...,
) -> None: ...
@classmethod
def from_range(cls, data, name=..., dtype=...): ...
def __reduce__(self): ...
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