Hi,
is there a way to configure to only show the first n
rows of a dataframe is streamlit?
Normal way to do this would be to just use df.head(n)
, however that does not quite work for my use case.
I have something like 10 rows and 5 columns. 3 of these columns represent scores and the other two are a name and a description.
I want to only show the top 5 scores, however if a user selects to sort the dataframe by a different score column (just via the standard streamlit ui), then the 5 top scores might change.
So a reduced example
Score 1 | Score 2 | Name |
---|---|---|
1 | 3 | A |
2 | 2 | B |
3 | 1 | C |
If the table is sorted by “Score 2” then A and B should be shown. But when the user clicks on the “Score 1” column to sort by it, it should now show C and B.
Is there any simple way to do that?
Cheers
Jan-Eric