Skip to content
2 changes: 1 addition & 1 deletion pandas/core/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def ensure_key_mapped(values, key: Optional[Callable], levels=None):
from pandas.core.indexes.api import Index

if not key:
return values.copy()
return values

if isinstance(values, ABCMultiIndex):
return ensure_key_mapped_multiindex(values, key, level=levels)
Expand Down