Skip to content

Commit 9498396

Browse files
slicing seems ambitious
1 parent 067d4b0 commit 9498396

File tree

1 file changed

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

1 file changed

+3
-2
lines changed

Diff for: packages/python/plotly/plotly/express/_core.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,8 @@ def get_groups_and_orders(args, grouper):
19381938
# we have a single group, so we can skip all group-by operations!
19391939
groups = {tuple(single_group_name): df}
19401940
else:
1941-
group_indices = df.groupby(grouper, sort=False).indices
1941+
grouped = df.groupby(grouper, sort=False)
1942+
group_indices = grouped.indices
19421943
sorted_group_names = [g if len(grouper) != 1 else (g,) for g in group_indices]
19431944

19441945
for i, col in reversed(list(enumerate(grouper))):
@@ -1950,7 +1951,7 @@ def get_groups_and_orders(args, grouper):
19501951
else -1,
19511952
)
19521953

1953-
groups = {s: df.iloc[group_indices[s]] for s in sorted_group_names}
1954+
groups = {s: grouped.get_group(s) for s in sorted_group_names}
19541955
return groups, orders
19551956

19561957

0 commit comments

Comments
 (0)