Skip to content

FutureWarning in _core.py #4505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ramedina86 opened this issue Feb 2, 2024 · 3 comments
Closed

FutureWarning in _core.py #4505

ramedina86 opened this issue Feb 2, 2024 · 3 comments
Labels
bug something broken P3 backlog

Comments

@ramedina86
Copy link

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')

@Coding-with-Adam
Copy link
Contributor

Thanks for reporting, @ramedina86 . Adding a similar report: #4500

@gvwilson gvwilson self-assigned this Jul 11, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 backlog bug something broken and removed pandas warning sev-1 blocker labels Aug 12, 2024
@MarcoGorelli
Copy link
Contributor

@LiamConnors I think this is should be addressed now, trying this out I get no warning

@LiamConnors
Copy link
Member

Thanks @MarcoGorelli. I think it was just never closed out when it was originally fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

5 participants