New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
experimental_data_editor selectbox support #6194
Comments
Second this! By specificing a columns as category one get the selectbox: 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},
]
)
df["command_as_category"] = df["command"].astype("category")
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}** 🎈") What I miss is to add possible values within this selectbox. Can someone tell if this is possible within the current streamlit version? |
Yes, this is already possible, see the comment above! Agree that we need to document it better (cc @snehankekre). There's no way to specify options right now but this will be possible as part of column config, which we plan to release in the next few months. You can see updates at https://roadmap.streamlit.app/ Closing this since it's already possible. |
There is a way to add additional categories to the selection via add_categories. For example: 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},
]
)
df["command_as_category"] = (
df["command"].astype("category").cat.add_categories(["st.button", "st.radio"])
)
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}** 🎈") |
I tried it and it works very nicely thanks a lot for this feature! |
Nice @LukasMasuch! Thanks for responding and great work! |
Problem
I'm trying to create a personal data editing tool to edit my labeled NER dataset of mine. Before the data editor, I was using text_area but the data editor is a much better solution. So I have 2 columns, token, and tag, for the tag I have options like B-PER I-PER, etc.
To edit the dataframe I have to delete the B-PER text and replace it with I-PER. But the problem is I'm a lazy person.
Solution
Can we somehow add a select box for every row? Currently, it is not possible because
streamlit.selectbox
creates the boxes instantly outside of the editorAdditional context
This is what I have:
Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.
If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.
The text was updated successfully, but these errors were encountered: