diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 48cf6000d100d..3d149eccc746b 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -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) diff --git a/pandas/tests/frame/methods/test_combine_first.py b/pandas/tests/frame/methods/test_combine_first.py index ad6122501bc19..f7da28a43590d 100644 --- a/pandas/tests/frame/methods/test_combine_first.py +++ b/pandas/tests/frame/methods/test_combine_first.py @@ -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]",