Skip to content

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

Open
@EpigeneMax

Description

@EpigeneMax

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

Activity

gvwilson

gvwilson commented on Oct 1, 2024

@gvwilson
Contributor

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

archmoj

archmoj commented on Oct 1, 2024

@archmoj
Contributor

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

EpigeneMax

EpigeneMax commented on Oct 1, 2024

@EpigeneMax
Author

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

LiamConnors

LiamConnors commented on Oct 1, 2024

@LiamConnors
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

added a commit that references this issue on Oct 2, 2024
f4b64cb
linked a pull request that will close this issue on Oct 2, 2024
added 4 commits that reference this issue on Oct 2, 2024
da0a4f4
b7f5707
fd104ad
233f87c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @gvwilson@LiamConnors@archmoj@EpigeneMax

      Issue actions

        sunburst errors with "Non-leaves are not permitted in the dataframe" · Issue #4774 · plotly/plotly.py