plotly / plotly/plotly.py

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

Aperta
#4,774 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

feature P3
Lingua principale
Python
Stelle
18.8k
Fork
2.8k
Merge medio
16h 26m
PR unite (30g)
21

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo l’esempio minimo di pandas e px.sunburst nell’issue, quindi segui la validazione del percorso sunburst che produce l’errore non-leaf. Il lavoro è completato quando il caso del leaf con nome che contiene un suffisso non genera più un errore spurio e il comportamento non-leaf esistente rimane coperto dai test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.