Skip to content

Commit b34bd6d

Browse files
Merge pull request #3249 from plotly/val_map5.0
uniquify category_orders
2 parents 68f1674 + e9be3dd commit b34bd6d

File tree

1 file changed

+3
-6
lines changed
  • packages/python/plotly/plotly/express

1 file changed

+3
-6
lines changed

packages/python/plotly/plotly/express/_core.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -1829,14 +1829,11 @@ def get_orderings(args, grouper, grouped):
18291829
orders = {} if "category_orders" not in args else args["category_orders"].copy()
18301830
for col in grouper:
18311831
if col != one_group:
1832-
uniques = args["data_frame"][col].unique()
1832+
uniques = list(args["data_frame"][col].unique())
18331833
if col not in orders:
1834-
orders[col] = list(uniques)
1834+
orders[col] = uniques
18351835
else:
1836-
orders[col] = list(orders[col])
1837-
for val in uniques:
1838-
if val not in orders[col]:
1839-
orders[col].append(val)
1836+
orders[col] = list(OrderedDict.fromkeys(list(orders[col]) + uniques))
18401837

18411838
sorted_group_names = []
18421839
for group_name in grouped.groups:

0 commit comments

Comments
 (0)