From 7378fdb1e44aad699dd598f4632b057ffe34b627 Mon Sep 17 00:00:00 2001 From: Giacomo Caria Date: Sat, 31 Jul 2021 00:07:43 +0200 Subject: [PATCH] Fix multiple identical check --- pandas/core/indexes/multi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index b4e8a763d1210..debdcdcc3f762 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -3534,7 +3534,7 @@ 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 self.codes) + and any(-1 in code for code in other.codes) or self.has_duplicates or other.has_duplicates ):