-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
add "Non-leaves rows are not permitted in the dataframe" with sunburst diagrams #3589
Comments
Just for anyone having also this issue, a workaround I used was replacing any df = df.applymap(lambda x: x if x else "null") # There are better approaches, only for clarity of preprocess
fig = px.icicle(
df,
path=df.columns,
)
figure_data = fig["data"][0]
mask = np.char.find(figure_data.ids.astype(str), "null") == -1
figure_data.ids = figure_data.ids[mask]
figure_data.values = figure_data.values[mask]
figure_data.labels = figure_data.labels[mask]
figure_data.parents = figure_data.parents[mask] |
thanks so much! |
It is sometimes useful to have non-leaf data in a Sunburst diagram. However, there is no way to tell Plotly Express to ignore or accept non-leaves.
Minimum viable example:
Gives the error:
This can be fixed by commenting out part of
plotly/express/_core.py
It would be great if
px.sunburst
could have an option to disable these checks, or to skip over any row which is not a leaf.How can I propose this as an option?
Thanks!
The text was updated successfully, but these errors were encountered: