# How to create a dropdown from a pandas dataframe column

**URL:** <https://community.plotly.com/t/how-to-create-a-dropdown-from-a-pandas-dataframe-column/42804>\
**Category:** 📊 Plotly Python\
**Created:** [July 22, 2020, 2:04pm UTC](https://community.plotly.com/t/how-to-create-a-dropdown-from-a-pandas-dataframe-column/42804 "2020-07-22T14:04:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![the\_dan](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@the\_dan](https://community.plotly.com/u/the_dan)\
**Post date:** [July 22, 2020, 2:04pm UTC](https://community.plotly.com/t/how-to-create-a-dropdown-from-a-pandas-dataframe-column/42804/1 "2020-07-22T14:04:41Z")

</div>

In the example below: [https://plotly.com/python/dropdowns/#restyle-dropdown](https://plotly.com/python/dropdowns/#restyle-dropdown)

The layout is created with a dictionary where every label is written one by one. But what if I import a database form a dynamic dataframe that changes its internal items every time?

In the following dataframe, every label is manually input. If I had a column in a dataframe with 30 inputs and I want the dropdown to be generated with every value of the column as a label. How can I do it?

```auto
fig.update_layout(
    updatemenus=[
        dict(
            buttons=list([
                dict(
                    args=["type", "surface"],
                    label="3D Surface",
                    method="restyle"
                ),
                dict(
                    args=["type", "heatmap"],
                    label="Heatmap",
                    method="restyle"
                )
            ]),
            direction="down",
            pad={"r": 10, "t": 10},
            showactive=True,
            x=0.1,
            xanchor="left",
            y=1.1,
            yanchor="top"
        ),
    ]
)

```
