I even have 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 desired to style my dataframes to help in visualising dataframes, but… surprise! As of the time of writing, Streamlit st.dataframe() doesn’t support styler objects, only dataframe objects. Well, correction, it does support them, however the UI display is horrendous!
Because of this I need to share with you my workarounds and concepts to constructing a well-styled dataframe in Streamlit. We are going to cover:
- How one can add commas for separating 1000’s in numbers.
- How one can display a number as a percentage (from 0.24 in the information to 24% within the UI)
- How one can add currency symbols.
- How one can add color to the cells. Even higher, I’ll share with you my favourite colour-grading function.
- How one can add emojis! Yes, we cant live without emojis 😊!
Streamlit is definitely pretty good at inferring the very best display based on data types. Imagine the…