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
8 changes: 2 additions & 6 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3503,12 +3503,8 @@ def equal_levels(self, other: MultiIndex) -> bool:

def _union(self, other, sort) -> MultiIndex:
other, result_names = self._convert_can_do_setop(other)
if (
any(-1 in code for code in self.codes)
and any(-1 in code for code in other.codes)
or other.has_duplicates
):
# This is only necessary if both sides have nans or other has dups,
if other.has_duplicates:
# This is only necessary if other has dupes,
# otherwise difference is faster
result = super()._union(other, sort)

Expand Down
6 changes: 1 addition & 5 deletions pandas/tests/frame/methods/test_combine_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,7 @@ def test_combine_first_string_dtype_only_na(self, nullable_string_dtype):
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",
):
df2.set_index(["a", "b"], inplace=True)
with tm.maybe_produces_warning(
PerformanceWarning,
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",
):
result = df.combine_first(df2)
result = df.combine_first(df2)
with tm.maybe_produces_warning(
PerformanceWarning,
pa_version_under7p0 and nullable_string_dtype == "string[pyarrow]",
Expand Down