The plotly dash

import dash
import dash_core_components as dcc
import dash_html_components as html
import as px
import pandas as pd
from dash.dependencies import Input, Output, State

df = pd.read_csv(‘E:\Epicenter\Project 1\Final Notupdated.csv’)
df = df.dropna()

app = dash.Dash(name)

app.layout = html.Div(
children = [
dcc.Dropdown(id = ‘my_dropdown’, multi = False,
options=[{‘label’ : “Support”, ‘value’ : “Support”},
{‘label’ : “Domestic”, ‘value’ : “Domestic”},
{‘label’ : “International”, ‘value’ : “International”}]),
dcc.Graph(id = ‘graph-output’, figure = {})

Output(component_id = ‘graph-output’, component_property = ‘figure’),
[Input(component_id = ‘my_dropdown’, component_property = ‘value’)],

def update_my_graph(val_chosen):
print(f"value user chose: {val_chosen}")
#dff = df[df[“Group”].isin(val_chosen)]
fig = px.scatter(df, x=“RAG_Status”, y=“Score”,color=df[“RAG Status”], hover_name=“Employee Name”)
return fig

if name == ‘main’:

Hello @Nidhi and welcome to the dash community!

Seems like this line filters the original df with the dropdown input, why is it commented?
And you are using the original df in your px.scatter() instead of dff which is filtered. As there is no filtered or new data being passed your graph figure will stay the same.

Another tip for you, while pasting your code on the forum make sure to click the code icon of the editor so that your code is formatted well with the correct indents.


When your app is first loaded there is no value selected in your dropdown which means NoneType value gets passed in your callback function initially, which causes the pandas error for NoneType.

You can tackle this by either:

  1. Setting some default values for your dropdown by using value parameter in the dcc.Dropdown component.
  2. If you don’t default selected values for your dropdown on initial load you can prevent the first callback from firing by setting prevent_initial_call=True.