N11
January 31, 2025, 2:34pm
1
Hello,
Is it possible to select all rows (or some rows) in a dataframe? Right now I have this code:
event = st.dataframe(
df,
use_container_width=True,
hide_index=True,
on_select="rerun",
selection_mode="multi-row",
height = min(((len(df) + 1) * 35 + 3), 350)
)
Is it possible to have all the rows selected upon starting the dashboard?
I am aware of this way to show selections but I like the functionality of the given example.
There are some old threads similar to this, stating it was not possible, but if any of you know of some recent changes or tricks to do this, it’s highly appreciated!
N11
February 4, 2025, 7:45am
2
Any suggestions are highly appreciated
Not at this time. The selection events are read only so you can’t programmatically set them from the server side.
There are a couple feature requests you can upvote on GitHub:
opened 10:19AM - 08 Jan 25 UTC
type:enhancement
feature:st.dataframe
### Checklist
- [X] I have searched the [existing issues](https://github.com/st… reamlit/streamlit/issues) for similar feature requests.
- [X] I added a descriptive title and summary to this issue.
### Summary
Is there any way to set selection on dataframe or data_editor ?
### Why?
_No response_
### How?
_No response_
### Additional Context
_No response_
opened 08:35AM - 12 Aug 24 UTC
type:enhancement
feature:st.dataframe
### Checklist
- [X] I have searched the [existing issues](https://github.com/… streamlit/streamlit/issues) for similar feature requests.
- [X] I added a descriptive title and summary to this issue.
### Summary
I applaud the Streamlit team for adding st.dataframe select options and responding to users wanting this for years.
Unfortunately, unlike a radio button as I (and many in the original request) hope for, the selection defaults to no selection, and the user can unselect.
### Why?
In my example, which can't be too uncommon, I want the user to be able to select from the dataframe to trigger which chart is displayed -- these are distinct measures so an 'all' option (which could take place of no rows selected) makes no sense.
I went as far as using pandas styler to colour the top row when no rows are selected, but this ended up pretty slow and clunky.
A minor quip: It's also pretty slow, I guess due to the mandatory on_select="rerun" parameter -- "ignore" just makes the select column not appear at all.
<img width="1015" alt="Screenshot 2024-08-12 at 3 26 13 PM" src="https://github.com/user-attachments/assets/ee41cf68-1c50-4a1b-99f8-f95725f2a920">
### How?
I'd suggest another selection_mode such as 'single_row_radio,' perhaps..
I guess, like st.radio, it would also need a default index selection (though this will be 0, 95% of the time for users)
I'd say this is *not* necessary for column selections
### Additional Context
_No response_
1 Like
system
Closed
August 4, 2025, 9:09am
5
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.