Skip to content

Commit 6b676bf

Browse files
Removed MultiIndex union overloading
1 parent 092eec2 commit 6b676bf

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

pandas-stubs/core/indexes/multi.pyi

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,8 @@ class MultiIndex(Index):
163163
def insert(self, loc, item): ...
164164
def delete(self, loc): ...
165165
def isin(self, values, level=...) -> np_1darray[np.bool]: ...
166-
@overload
167166
def union(
168167
self,
169-
other: Self | list[tuple[Hashable, ...]],
168+
other: Self | Index | list[HashableT],
170169
sort: bool | None = ...,
171170
) -> Self: ...
172-
@overload
173-
def union(
174-
self,
175-
other: Index | list[HashableT],
176-
sort: bool | None = ...,
177-
) -> Index: ...

pandas-stubs/py.typed

Whitespace-only changes.

tests/indexes/test_indexes.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,20 +1603,15 @@ def test_to_series() -> None:
16031603
check(assert_type(Index(["1"]).to_series(), "pd.Series[str]"), pd.Series, str)
16041604

16051605

1606-
def test_swaplevel_rettype() -> None:
1607-
"""Test that swaplevel returns Self"""
1606+
def test_multiindex_swaplevel_rettype() -> None:
1607+
"""Test that union returns MultiIndex on MultiIndex input and swaplevel returns Self"""
16081608
mi = pd.MultiIndex.from_product([["a", "b"], [1, 2]], names=["let", "num"])
1609+
mi2 = pd.MultiIndex.from_product([["a", "b"], [3, 4]], names=["let", "num"])
1610+
16091611
check(
16101612
assert_type(mi.swaplevel(0, 1), "pd.MultiIndex"),
16111613
pd.MultiIndex,
16121614
)
1613-
1614-
1615-
def test_multiindex_union() -> None:
1616-
"""Test that union returns MultiIndex on MultiIndex input"""
1617-
mi = pd.MultiIndex.from_product([["a", "b"], [1, 2]], names=["let", "num"])
1618-
mi2 = pd.MultiIndex.from_product([["a", "b"], [3, 4]], names=["let", "num"])
1619-
16201615
check(
16211616
assert_type(mi.union(mi2), "pd.MultiIndex"),
16221617
pd.MultiIndex,

0 commit comments

Comments
 (0)