-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Description
Upgrading to plotly 6.0.1 from 5.24.1, seeing the behavior difference below
import pandas as pd
import plotly
import plotly.express as px
import json
df = pd.DataFrame({"date": ["Apr 2023", "Sep 2023", "Jan 2023", "Dec 2023", "Apr 2023", "Jul 2023", "Jan 2023", "Oct 2023"], "value": [4, 9, 1, 12, 4, 7, 1, 10], "group": ["A", "A", "A", "A", "B", "B", "B", "B"]})
df_grouped = df.groupby(["group", "date"])["value"].sum().reset_index()
fig = px.line(df_grouped, x="date", y="value", color="group")
json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
> '{"data":... "xaxis": "x", "y": {"dtype": "i1", "bdata": "BAwBCQ=="}, "yaxis": "y", "type": "scatter" ...}
fig.to_json()
> '{"data":...,"xaxis":"x","y":{"dtype":"i1","bdata":"BAwBCQ==" ...}In 5.24.1
json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
> {"data": ..., "xaxis": "x", "y": [4, 12, 1, 9], ...}
fig.to_json()
> '{"data":...,"xaxis":"x","y":[4,12,1,9], ...}Note that fig.data[0].y is serialized into {"dtype": "i1", "bdata": "BAwBCQ=="} rather than a list. Is that expected behavior with the new version?
Metadata
Metadata
Assignees
Labels
No labels