sunburst errors with "Non-leaves are not permitted in the dataframe"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
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")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimal pandas and px.sunburst example in the issue, then trace the sunburst path validation that produces the non-leaf error. Done means the suffix-named leaf case no longer raises a spurious error while the existing non-leaf behavior remains covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100