Skip to content
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

sunburst errors with "Non-leaves are not permitted in the dataframe" #4774

Open
EpigeneMax opened this issue Oct 1, 2024 · 4 comments · May be fixed by #4776
Open

sunburst errors with "Non-leaves are not permitted in the dataframe" #4774

EpigeneMax opened this issue Oct 1, 2024 · 4 comments · May be fixed by #4776
Labels
feature something new P3 not needed for current cycle

Comments

@EpigeneMax
Copy link

The logic to check for non-leaves is dubious, e.g. a leaf whose name is a suffix of another leaf triggers an error.
The check also depends on the alphabetical ordering on the leaves.

As suggested by #3589, I wonder whether this non-leaf detection is really meaningful.
I'd be happy to write a PR to remove this check. Thoughts?

minimal working example

import pandas as pd
import plotly.express as px

df = pd.DataFrame(
    {
        "status": ["NOT_YET_COMPLETED", "COMPLETED"],
        "next_step": ["Wrapup", None],
        "count": [1, 2],
    }
)
# no error
px.sunburst(df, path=["status", "next_step"], values="count")

df.loc[0, "status"] = "ACTIVE_NOT_YET_COMPLETED"
# error (spurious)
px.sunburst(df, path=["status", "next_step"], values="count")
@gvwilson gvwilson added feature something new P3 not needed for current cycle labels Oct 1, 2024
@gvwilson
Copy link
Contributor

gvwilson commented Oct 1, 2024

@archmoj does this belong here or in plotly.js?

@archmoj
Copy link
Contributor

archmoj commented Oct 1, 2024

@LiamConnors would you please create a codepen and transfer it to plotly.js?

@EpigeneMax
Copy link
Author

I think the dubious check in on the Python side, plotly/express/_core.py lines 1637 -- 1644.

@LiamConnors
Copy link
Member

@LiamConnors would you please create a codepen and transfer it to plotly.js?

The logic is in plotly.express and prevents the figure from being generated so it's not possible to create a codepen for plotly.js

EpigeneMax added a commit to EpigeneMax/plotly.py that referenced this issue Oct 2, 2024
@EpigeneMax EpigeneMax linked a pull request Oct 2, 2024 that will close this issue
5 tasks
EpigeneMax added a commit to EpigeneMax/plotly.py that referenced this issue Oct 2, 2024
EpigeneMax added a commit to EpigeneMax/plotly.py that referenced this issue Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 not needed for current cycle
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants