Skip to content

DEPR: Deprecate try_sort #33902

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 13 commits into from
May 5, 2020
8 changes: 0 additions & 8 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,6 @@ def count_not_none(*args) -> int:
return sum(x is not None for x in args)


def try_sort(iterable):
listed = list(iterable)
try:
return sorted(listed)
except TypeError:
return listed


def asarray_tuplesafe(values, dtype=None):

if not (isinstance(values, (list, tuple)) or hasattr(values, "__array__")):
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/indexes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ def _sanitize_and_check(indexes):
if list in kinds:
if len(kinds) > 1:
indexes = [
Index(com.try_sort(x)) if not isinstance(x, Index) else x
for x in indexes
Index(list(x)) if not isinstance(x, Index) else x for x in indexes
]
kinds.remove(list)
else:
Expand Down