# Make a dropdown menu using df columns as options

**URL:** <https://community.plotly.com/t/make-a-dropdown-menu-using-df-columns-as-options/47104>\
**Category:** Dash Python\
**Created:** [November 12, 2020, 3:03pm UTC](https://community.plotly.com/t/make-a-dropdown-menu-using-df-columns-as-options/47104 "2020-11-12T15:03:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafa](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@rafa](https://community.plotly.com/u/rafa)\
**Post date:** [November 12, 2020, 3:03pm UTC](https://community.plotly.com/t/make-a-dropdown-menu-using-df-columns-as-options/47104/1 "2020-11-12T15:03:50Z")

</div>

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:

```auto
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(
    [
        dcc.Dropdown(id='stockselector',
                           options=labels,
                           #multi=True,
                           value=valuess,),
        dcc.Graph(figure=fig),
    ]
)

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

```
