Skip to content

Commit 433439c

Browse files
committed
Add to_tuples method to IntervalIndex
1 parent cb23bb5 commit 433439c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pandas-stubs/core/indexes/interval.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ class IntervalIndex(IntervalMixin, ExtensionIndex, Generic[IntervalT]):
213213
copy: bool = ...,
214214
dtype: IntervalDtype | None = ...,
215215
) -> IntervalIndex[pd.Interval[pd.Timedelta]]: ...
216+
def to_tuples(self, na_tuple: bool = ...) -> pd.Index: ...
216217
@overload
217218
def __contains__(self, key: IntervalT) -> bool: ... # type: ignore[misc]
218219
@overload

tests/test_interval_index.py

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def test_from_tuples() -> None:
3131
)
3232

3333

34+
def test_to_tuples() -> None:
35+
ind = pd.IntervalIndex.from_tuples([(0, 1), (1, 2)]).to_tuples()
36+
check(assert_type(ind, pd.Index), pd.Index)
37+
38+
3439
def test_is_overlapping() -> None:
3540
ind = pd.IntervalIndex.from_tuples([(0, 2), (1, 3), (4, 5)])
3641
check(assert_type(ind.is_overlapping, bool), bool)

0 commit comments

Comments
 (0)