✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

The very first dash/plotly example is broken

The very first introductory example to using Dash is broken. Here is the link of the example I am talking about:

https://dash.plotly.com/layout

I installed Dash, and then I copied/pasted the first code example into a Python file and attempted to run it. It crashed on the following line of code:

fig = px.bar(df, x=“x”, y=[“SF”, “Montreal”], barmode=“group”)

And it gave the following error:

Value of ‘y’ is not the name of a column in ‘data_frame’. Expected one of [‘x’, ‘SF’, ‘Montreal’] but received: [‘SF’, ‘Montreal’]

As a reminder, the dataframe was instantiated on the previous line of code and looks like this:

df = pd.DataFrame({“x”: [1, 2, 3], “SF”: [4, 1, 2], “Montreal”: [2, 4, 5]})

When I change the offending line of code to only attempt to plot a single variable rather than 2 variables, it works fine:

fig = px.bar(df, x=“x”, y=“SF”, barmode=“group”)

Any reason the example is not working? Thank you!!!

Can you try upgrading plotly?