I’ve at all times been a fan of the styler method in pandas. Once I began constructing Streamlit apps, it was clear to me that I wished to model my dataframes to help in visualising dataframes, however… shock! As of the time of writing, Streamlit st.dataframe() doesn’t help styler objects, solely dataframe objects. Nicely, correction, it does help them, however the UI show is horrendous!
This is the reason I need to share with you my workarounds and concepts to constructing a well-styled dataframe in Streamlit. We’ll cowl:
- Find out how to add commas for separating hundreds in numbers.
- Find out how to show a quantity as a share (from 0.24 within the knowledge to 24% within the UI)
- Find out how to add foreign money symbols.
- Find out how to add color to the cells. Even higher, I’ll share with you my favorite colour-grading operate.
- Find out how to add emojis! Sure, we cant reside with out emojis 😊!
Streamlit is definitely fairly good at inferring the perfect show primarily based on knowledge varieties. Think about the…