Multi dropdown -> dataframe manipulations -> bargraph

Hi! I had previously posted a post about updating a bar graph from a dropdown input.

Dash: dropdown input to update bargraph out

I was able to create a working app as seen here:

and github here:

Now, I want to update my webapp by including a multi dropdown to update my bargraphs.

So my major issue is that my original code that I hacked together doesn’t match up with the dash documentation for dropdown implementations as seen here:

def update_graph(selected_product1, selected_product2):
    dff = df[(df[selected_product1] >= 2) & (df[selected_product2] >= 2)]
    trace1 = go.Bar(x=dff['state'], y=dff[selected_product1], name=selected_product1.title(), )
    trace2 = go.Bar(x=dff['state'], y=dff[selected_product2], name=selected_product2.title(), )

compared to

def update_graph(dropdown):
  a = df.set_index(['drug'])
  name = dropdown
  a1 = a.loc[[name]].mean().to_frame().reset_index()
  return {'data': [go.Bar(

I see that the former syntax is easier to format to multi-dropdowns as shown here:

Callbacks with a drop down with multi select

                  id = "dropdown_geoloc",
                  options= list_region, #The list has around 6/7 cities
                  value=['Zürich', 'Basel'], #Initial values,

    [Input(component_id='dropdown_geoloc', component_property='value'])

def update_df(town):
	new_df = df1[(df1['region'].isin(town)]

where the list of the mutli dropdowns selected options would be picked from the ‘.isin’ method.

However I am running into some problems transitioning my code into that of the documentation format.

My code

def update_graph(dropdown)
  dff = drug_df[drug_df['drug']==dropdown]

  return {
    'data': [
        x= dff['drug'],
        y= dff['Effectiveness']

drug_df looks likes this


The problem now is that the app loads but the graph does not update. I don’t see any errors either so I’m asking for help on why my input data is not flowing through to my bargraph(single input).

Thank you! and if there is anything I can do, ask me down here!