diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 3f89b0619e600..d1d71e584ae3d 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -2379,6 +2379,10 @@ def unique(self, level=None): """ if level is not None: self._validate_index_level(level) + + if self.is_unique: + return self._shallow_copy() + result = super().unique() return self._shallow_copy(result) @@ -2864,7 +2868,7 @@ def _intersection(self, other, sort=False): result = algos.safe_sort(result) # Intersection has to be unique - assert algos.unique(result).shape == result.shape + assert Index(result).is_unique return result