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
9 changes: 0 additions & 9 deletions pandas/core/indexes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,6 @@ def fillna(self, value, downcast=None):

return type(self)._simple_new(cat, name=self.name)

@doc(Index.unique)
def unique(self, level=None):
if level is not None:
self._validate_index_level(level)
result = self._values.unique()
# Use _simple_new instead of _shallow_copy to ensure we keep dtype
# of result, not self.
return type(self)._simple_new(result, name=self.name)

def reindex(
self, target, method=None, level=None, limit=None, tolerance=None
) -> tuple[Index, np.ndarray | None]:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _get_unique_index(self):
return self

result = self._data.unique()
return self._shallow_copy(result)
return type(self)._simple_new(result, name=self.name)

@doc(Index.map)
def map(self, mapper, na_action=None):
Expand Down