# Dropdown labels show "ALL" and individual values in df

**URL:** https://community.plotly.com/t/dropdown-labels-show-all-and-individual-values-in-df/50399
**Category:** Dash Python
**Created:** [February 24, 2021, 12:38pm UTC](https://community.plotly.com/t/dropdown-labels-show-all-and-individual-values-in-df/50399 "2021-02-24T12:38:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jch1](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@jch1](https://community.plotly.com/u/jch1)
#### Post date: [February 24, 2021, 12:38pm UTC](https://community.plotly.com/t/dropdown-labels-show-all-and-individual-values-in-df/50399/1 "2021-02-24T12:38:45Z")

</div>

I have a dropdown menu called gender with default value “ALL” for a chart. When the page loads, the page shows a chart with all aggregated data. After clicking a gender label, the chart updates accordingly. The problem is that it is not possible to go back to the “ALL” chart again. I would like to have the dropdown labels of “ALL” and individual genders but they don’t work together. The code also shows there is an error at the position of for loop and I have remove the “ALL” label to get rid of the error.

dcc.Dropdown(

```
    id='gender-dropdown',

    options=[

        {'label': 'ALL', 'value': 'ALL'},

        {'label': gender, 'value': gender } 

        for gender in df['gender'].unique()

    ],

    value='ALL'

),
```

---

<div class="post-metadata">

### Author: ![Eduardo](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/eduardo/32/13310_2.png) [@Eduardo](https://community.plotly.com/u/Eduardo)
#### Post date: [February 24, 2021, 12:46pm UTC](https://community.plotly.com/t/dropdown-labels-show-all-and-individual-values-in-df/50399/2 "2021-02-24T12:46:07Z")

</div>

@jch1

I think you need to include **“ALL”** as another option in your **df['gender´]** and change the options to:

```auto
    options=[

        {'label': gender, 'value': gender } 

        for gender in df['gender'].unique()

    ],

    value='ALL'

),

```

---

<div class="post-metadata">

### Author: ![jch1](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@jch1](https://community.plotly.com/u/jch1)
#### Post date: [February 24, 2021, 3:20pm UTC](https://community.plotly.com/t/dropdown-labels-show-all-and-individual-values-in-df/50399/3 "2021-02-24T15:20:06Z")

</div>

Thanks. The suggestion should work but it will require modifying the df.  
Got an idea from [this post.](https://www.statworx.com/at/blog/how-to-build-a-dashboard-in-python-plotly-dash-step-by-step-tutorial/). Put the list in a function.

Creates a list of dictionaries, which have the keys ‘label’ and ‘value’.

```
def get_options(list_stocks):
    dict_list = []
    dict_list.append('ALL')
    for i in list_stocks:
        dict_list.append({'label': i, 'value': i})

    return dict_list

options=get_options(df['stock'].unique()),
```
