Skip to content

Commit 1d73a56

Browse files
authored
CLN: MultiIndex._union (#50574)
* CLN: MultiIndex._union * remove test for warning
1 parent 3b26841 commit 1d73a56

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

pandas/core/indexes/multi.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3503,12 +3503,8 @@ def equal_levels(self, other: MultiIndex) -> bool:
35033503

35043504
def _union(self, other, sort) -> MultiIndex:
35053505
other, result_names = self._convert_can_do_setop(other)
3506-
if (
3507-
any(-1 in code for code in self.codes)
3508-
and any(-1 in code for code in other.codes)
3509-
or other.has_duplicates
3510-
):
3511-
# This is only necessary if both sides have nans or other has dups,
3506+
if other.has_duplicates:
3507+
# This is only necessary if other has dupes,
35123508
# otherwise difference is faster
35133509
result = super()._union(other, sort)
35143510

pandas/tests/frame/methods/test_combine_first.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,7 @@ def test_combine_first_string_dtype_only_na(self, nullable_string_dtype):
398398
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",
399399
):
400400
df2.set_index(["a", "b"], inplace=True)
401-
with tm.maybe_produces_warning(
402-
PerformanceWarning,
403-
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",
404-
):
405-
result = df.combine_first(df2)
401+
result = df.combine_first(df2)
406402
with tm.maybe_produces_warning(
407403
PerformanceWarning,
408404
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",

0 commit comments

Comments
 (0)