File tree 1 file changed +3
-2
lines changed
packages/python/plotly/plotly/express
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1938,7 +1938,8 @@ def get_groups_and_orders(args, grouper):
1938
1938
# we have a single group, so we can skip all group-by operations!
1939
1939
groups = {tuple (single_group_name ): df }
1940
1940
else :
1941
- group_indices = df .groupby (grouper , sort = False ).indices
1941
+ grouped = df .groupby (grouper , sort = False )
1942
+ group_indices = grouped .indices
1942
1943
sorted_group_names = [g if len (grouper ) != 1 else (g ,) for g in group_indices ]
1943
1944
1944
1945
for i , col in reversed (list (enumerate (grouper ))):
@@ -1950,7 +1951,7 @@ def get_groups_and_orders(args, grouper):
1950
1951
else - 1 ,
1951
1952
)
1952
1953
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 }
1954
1955
return groups , orders
1955
1956
1956
1957
You can’t perform that action at this time.
0 commit comments