Misleading error message when an invalid y column name is provided to px.line
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
When attempting to plot multiple y values using px.line (or similar), erroneous column names lead to a misleading error message that states that the length of the arguments is incorrect, when in fact the problem is that there the column name is wrong.
Simple to reproduce:
import plotly.express as px
import pandas as pd
import numpy as np
x = np.linspace(0, 10, 100)
data1 = x**2
data2 = x**3
df = pd.DataFrame({"x": x, "data1": data1, "data2": data2})
px.line(df, x = "x", y = ["data1", "data2"]) # works fine
px.line(df, x = "x", y = ["data1", "Data2"])
# this last line gives a misleading error message:
# ValueError: All arguments should have the same length. The length of argument `y` is 2,
# whereas the length of previously-processed arguments ['x'] is 100
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die pandas- und NumPy-Reproduktion des Issues mit px.line auszuführen, und verfolge dann den Validierungspfad, der für die Argumente x und y verwendet wird. Als erledigt gilt, wenn ein ungültiger Name einer y-Spalte einen korrekten, spaltenbezogenen Fehler erzeugt und gültige Eingaben mit mehreren y-Werten weiterhin funktionieren; die Nutzlast nennt keine bestimmte Datei oder keinen bestimmten Test.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100