Choose value from st.select into st.experimental_data_editor table

I’m taking a little guess as to your meaning…

You can set a column to have categorical data type. In this instance the data editor will present the user with a select box when they edit cells in that column.

import streamlit as st
import pandas as pd

if 'df' not in st.session_state:
    df = pd.DataFrame({'A':[True, False, True],'B':['cat','cat','dog']})
    df['B'] = df['B'].astype(pd.CategoricalDtype(['cat','dog','bird']))
    st.session_state.df = df

df = st.session_state.df

st.experimental_data_editor(df, num_rows='dynamic')

image

3 Likes