Skip to content

Commit 9c02c36

Browse files
authored
GH1158 change type of tuples param for MultiIndex.from_tuples (#1201)
change type of tuples param for MultiIndex.from_tuples
1 parent 524cce1 commit 9c02c36

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pandas-stubs/core/indexes/multi.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from collections.abc import (
22
Callable,
33
Hashable,
4+
Iterable,
45
Sequence,
56
)
67
from typing import (
@@ -46,7 +47,7 @@ class MultiIndex(Index[Any]):
4647
@classmethod
4748
def from_tuples(
4849
cls,
49-
tuples: Sequence[tuple[Hashable, ...]],
50+
tuples: Iterable[tuple[Hashable, ...]],
5051
sortorder: int | None = ...,
5152
names: SequenceNotStr[Hashable] = ...,
5253
) -> Self: ...

tests/test_indexes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ def test_multiindex_constructors() -> None:
9494
),
9595
pd.MultiIndex,
9696
)
97+
check(
98+
assert_type(pd.MultiIndex.from_tuples(zip([1, 2], [3, 4])), pd.MultiIndex),
99+
pd.MultiIndex,
100+
)
97101
check(
98102
assert_type(pd.MultiIndex.from_tuples([(1, 3), (2, 4)]), pd.MultiIndex),
99103
pd.MultiIndex,

0 commit comments

Comments
 (0)