Skip to content

REF: avoid runtime import of Index #32710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 15, 2020
4 changes: 1 addition & 3 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2025,9 +2025,7 @@ def sort_mixed(values):
)
codes = ensure_platform_int(np.asarray(codes))

from pandas import Index

if not assume_unique and not Index(values).is_unique:
if not assume_unique and not len(unique(values)) == len(values):
raise ValueError("values should be unique if codes is not None")

if sorter is None:
Expand Down