Streamlit and the pandas Styler object will not be mates. However, we are going to change that!
I’ve at all times been a fan of the styler methodology in pandas. After I began constructing Streamlit apps, it was clear to me that I needed to model my dataframes to assist in visualising dataframes, however… shock! As of the time of writing, Streamlit st.dataframe() doesn’t assist styler objects, solely dataframe objects. Effectively, correction, it does assist them, however the UI show is horrendous!
This is the reason I wish to share with you my workarounds and concepts to constructing a well-styled dataframe in Streamlit. We’ll cowl:
add commas for separating hundreds in numbers. show a quantity as a share (from 0.24 within the knowledge to 24% within the UI) add forex symbols. add color to the cells. Even higher, I’ll share with you my favorite colour-grading operate. add emojis! Sure, we cant stay with out emojis 😊!
Streamlit is definitely fairly good at inferring one of the best show based mostly on knowledge varieties. Think about the…