Can i create a rating system by adding stars into each records using streamlit?

After many hours of research i did not find any tutorial on how to add rating function by using the slider and stars.

I am trying to create a function that allow the user to rate each record in the dataframe by using slider from 1 to 5 and once the user select the value of the slider the starts appear in the rating column.

How can this be done using python and streamlit .

Hey @leb_dev,

I saw that this got answered on your other post, so I am copying that over here for any users that may come to your question in the future! (kudos to @BeyondMyself for this answer)

Happy Streamlit-ing!

this answer partially on my question because i need to apply this rating on each record on the dataframe

AH, So are you looking to create a column in your data frame that will hold the ratings from the slider?

I almost think that you would need to create a column that holds a list of numbers that you can append the latest rating on the end of it.

if you are using pandas I found a solution here for you: Python pandas insert list into a cell - Stack Overflow

df = pd.DataFrame({
    'A': [0, 1, 2, 3],
    'B': np.array([np.nan]*3 + [[3, 33]], dtype=object),


   A        B
0  0      NaN
1  1      NaN
2  2      NaN
3  3  [3, 33]

also, check out this link on how to use your list values once you put them in there:

Happy Streamlit-ing!

Yes thatbis exactly what i want to create a column that handle the rating in the dataframe

1 Like