Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of categorical dates
Browse files Browse the repository at this point in the history
mwaskom committed Jan 5, 2021
1 parent 0dce5fa commit a12e998
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions seaborn/categorical.py
Original file line number Diff line number Diff line change
@@ -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,15 +126,15 @@ 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

# 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):

0 comments on commit a12e998

Please sign in to comment.