-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
Description
Using plotly==5.18.0 and pandas==2.2.0.
I get the following FutureWarning
.venv/lib/python3.12/site-packages/plotly/express/_core.py:2065: FutureWarning: When grouping with a length-1 list-like, you will need to pass a length-1 tuple to get_group in a future version of pandas. Pass `(name,)` instead of `name` to silence this warning.
sf: grouped.get_group(s if len(s) > 1 else s[0])
I can suppress the warning by fixing a line in get_groups_and_orders()
sf: grouped.get_group(s if len(s) > 1 else s[0])
to
sf: grouped.get_group(s if len(s) > 1 else (s[0], ))
In my case, this only happens when I include color, which seems to trigger the grouping by tuple:
This doesn't work: fig = px.bar(main_df, x='role', y='count', color='role')
This works: fig = px.bar(main_df, x='role', y='count')
MusicScience37, jkoestner, Tanguy-LeFloch and ElisaFernandezCastillo