Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Make a dropdown menu using df columns as options

Hey there, I´m trying to create a dropdown menu using the df column names as options, also need to update the pie plot depending of the selected option…

Here´s the code:

i = 0 # Counter

for col in df: 
    values = filter_df_trimmed[col].value_counts()
    labels = values.index.unique()
    #fig = go.Figure(data=[go.Pie(labels=labels, values=values, title=df.columns[i])])    #plotly go
    fig = px.pie(filter_df_trimmed, values=values, names=labels, title=df.columns[i], hole=.3, color_discrete_sequence=px.colors.sequential.Mint)             #plotly express
    i = i+1 

valuess = filter_df_trimmed[col].to_list()
labels = values.index.unique()

column2 = dbc.Col(

layout = dbc.Row([column1, column2])