0

I am trying to create a basic Dash app in a Jupyter notebook with JupyterDash. The dropdown menu is displaying the below error message when I run the script.

enter image description here

Below is the code I am using. I am not sure what I am doing wrong here. Any help would be greatly appreciated.

# import the libraries
from pathlib import Path
import plotly.express as px
import dash
from dash import Dash, dcc, html
from dash.dependencies import Input, Output, State
import pandas as pd
import dash_bootstrap_components as dbc
from jupyter_dash import JupyterDash
# Load the Dataframe
df = pd.read_csv(Path("./ds_salaries.csv"))
# Preview the dataset
df.head()
# Create the dash app
app = JupyterDash(__name__)
# Bar chart employee residence
fig = px.histogram(df, x="employee_residence")

# Set up the app layout - dropdown for job title
app.layout = html.Div(children=[
    html.H1('Data Science Job Analyzer', style={'textAlign':'center'}),
    html.Br(),
    dcc.Dropdown(
        id='job-dropdown',
        options=df["job_title"].unique(),
        style={"width": "50%", "offset":1,},
        clearable=False
    ),
    dcc.Graph(id='hist', figure=fig)
])
# Run local server
if __name__ == '__main__':
    app.run_server(debug=True)
  • I am guessing from the error message that the dropdown value is a string? – r-beginners Nov 03 '22 at 02:21
  • Please add the entire code to spot the issue easily because the provided code works without any errors on my machine. Thus, there are some lines of code not added to your question. – Hamzah Nov 03 '22 at 06:33

0 Answers0