support range() as keyword argument for go.Scatter
Offen
Dieses Issue hat noch niemand übernommen.
feature
P3
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
In Jupyter notebook:
import plotly.graph_objects as go
go.Figure(go.Scatter(x=range(3), y=[3, 2, 1]))
Output:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-1-be3f9396b95f> in <module>
1 import plotly.graph_objects as go
----> 2 go.Figure(go.Scatter(x=range(3), y=[3, 2, 1]))
/usr/lib/python3.7/site-packages/plotly/graph_objs/__init__.py in __init__(self, arg, cliponaxis, connectgaps, customdata, customdatasrc, dx, dy, error_x, error_y, fill, fillcolor, groupnorm, hoverinfo, hoverinfosrc, hoverlabel, hoveron, hovertemplate, hovertemplatesrc, hovertext, hovertextsrc, ids, idssrc, legendgroup, line, marker, meta, metasrc, mode, name, opacity, orientation, r, rsrc, selected, selectedpoints, showlegend, stackgaps, stackgroup, stream, t, text, textfont, textposition, textpositionsrc, textsrc, tsrc, uid, uirevision, unselected, visible, x, x0, xaxis, xcalendar, xsrc, y, y0, yaxis, ycalendar, ysrc, **kwargs)
39689 self["visible"] = visible if visible is not None else _v
39690 _v = arg.pop("x", None)
> 39691 self["x"] = x if x is not None else _v
39692 _v = arg.pop("x0", None)
39693 self["x0"] = x0 if x0 is not None else _v
/usr/lib/python3.7/site-packages/plotly/basedatatypes.py in __setitem__(self, prop, value)
3351 # ### Handle simple property ###
3352 else:
-> 3353 self._set_prop(prop, value)
3354
3355 # Handle non-scalar case
/usr/lib/python3.7/site-packages/plotly/basedatatypes.py in _set_prop(self, prop, val)
3634 return
3635 else:
-> 3636 raise err
3637
3638 # val is None
/usr/lib/python3.7/site-packages/plotly/basedatatypes.py in _set_prop(self, prop, val)
3629 validator = self._validators.get(prop)
3630 try:
-> 3631 val = validator.validate_coerce(val)
3632 except ValueError as err:
3633 if self._skip_invalid:
/usr/lib/python3.7/site-packages/_plotly_utils/basevalidators.py in validate_coerce(self, v)
387 v = to_scalar_or_list(v)
388 else:
--> 389 self.raise_invalid_val(v)
390 return v
391
/usr/lib/python3.7/site-packages/_plotly_utils/basevalidators.py in raise_invalid_val(self, v, inds)
281 typ=type_str(v),
282 v=repr(v),
--> 283 valid_clr_desc=self.description(),
284 )
285 )
ValueError:
Invalid value of type 'builtins.range' received for the 'x' property of scatter
Received value: range(0, 3)
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Plotly is installed from Arch Linux AUR, based on version 4.1.0, built using this script.
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
Das Jupyter-Beispiel mit go.Scatter(x=range(3), y=[3, 2, 1]) reproduzieren und anschließend die in der Stacktrace angezeigte Validierung der x-property nachverfolgen. Regression-Tests für range-Werte hinzufügen und bestätigen, dass das Beispiel ohne den invalid-value-Fehler erfolgreich ausgeführt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- jupyter-notebook, plotly, 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
- 38/100