Insert check button inside a dataframe

Hi, is there a way to insert some check button inside a table showed on screen using st.dataframe?

Hey @Cerri,

Check out the first example in the doc for st.experimental_data_editor. I’ll paste it below as well.

import streamlit as st
import pandas as pd

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},
   ]
)
edited_df = st.experimental_data_editor(df)

favorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]
st.markdown(f"Your favorite command is **{favorite_command}** 🎈")
2 Likes

Thanks @Caroline.

@Caroline It is possible to add colors on cells of a column based on their values? The documentation of st.experimental_data_editor says that is possible to use pd.Styler as input type, but when I use it by adding colors they are not render at all. The same styler pandas dataframe is rended correctly using st.dataframe() instead. How can I solve it?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.