Editable dataframe dropdown

I see that you can change a column type to categorical to render a dropdown but that takes only the values currently in the column. Is there a way to pass a custom list of values that is shown as dropdown options for a column?

Could you post a minimal example code?

You can add additional values to the dropdown - see here. Not sure if you can remove existing options though.

1 Like

Try the remove_categories method.

import pandas as pd
import streamlit as st

df = pd.DataFrame(
        {"command": "st.selectbox", "rating": 4, "is_widget": True},
        {"command": "st.balloons", "rating": 5, "is_widget": False},
        {"command": "st.time_input", "rating": 3, "is_widget": True},

custom_cat = ['aaa', 'bbb']

df["command_as_category"] = (

edited_df = st.experimental_data_editor(df)

I don’t want to create new column. I’d like the dropdown to shown for an existing column. I.e in the above code for command column. Is it possible?


Just change command_as_category to command.

1 Like