Skip to content

REF: add custom Exception for safe_sort #25569

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

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
fix ci failure
  • Loading branch information
simonjayhawkins committed Mar 27, 2019
commit 28885391e90acb082038fbc6aaf06c7520bb7e6d
4 changes: 2 additions & 2 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from pandas.core.base import NoNewAttributesMixin, PandasObject, _shared_docs
import pandas.core.common as com
from pandas.core.missing import interpolate_2d
from pandas.core.sorting import SortError, nargsort
from pandas.core.sorting import nargsort

from pandas.io.formats import console
from pandas.io.formats.terminal import get_terminal_size
Expand Down Expand Up @@ -357,7 +357,7 @@ def __init__(self, values, categories=None, ordered=None, dtype=None,
if dtype.categories is None:
try:
codes, categories = factorize(values, sort=True)
except SortError:
except TypeError:
codes, categories = factorize(values, sort=False)
if dtype.ordered:
# raise, as we don't have a sortable data structure and so
Expand Down