diff --git a/seaborn/categorical.py b/seaborn/categorical.py index 5722a92b5f..364e876a91 100644 --- a/seaborn/categorical.py +++ b/seaborn/categorical.py @@ -99,7 +99,7 @@ def __init__( # XXX should we try to auto-format dates to a nice representation, # and perhaps expose a formatter object to do it? cat_data = cat_data.astype(str) - order = list(map(str, order)) + order = pd.Index(order).astype(str) # XXX here we are inserting the levels of the categorical variable # into the var_levels object so that it can be used in iter_data. @@ -126,7 +126,7 @@ def __init__( # overriding a given order list, which isn't what the logic of # categorical_order says should happen, but does because _attach doesn't # get the order argument. This *should* resolve that problem. - if cat_data.cat.categories.to_list() != order: + if not cat_data.cat.categories.equals(order): cat_data = cat_data.cat.set_categories(order, ordered=True) self.plot_data[self.cat_axis] = cat_data @@ -134,7 +134,7 @@ def __init__( # XXX Need to decide if this is something that should hang around on the plotter # adding it now so that function bodies can make use of possibly type-converted # order list. - self.order = order + self.order = order.to_list() @property def cat_axis(self):