Hello, I am using st.table to show a table to which I apply pandas style.
Locally, fixing versions of pandas and streamlit (to those available in snowflake), the style is applied properly, but when I deploy the dashboard in snowflake, it works but the styling is not applied.
What could be the reason? It does not break, the dashboard works, but it’s like there was no style being applied.
Thank you.
Here is a corner of the table in local first and then deployed in Snowflake:
I created a minimum code example so this can be recreated. The code:
import streamlit as st
import pandas as pd
data = {
'A': [1, 2, 3, 4, 5],
'B': [5, 4, 3, 2, 1]
}
df = pd.DataFrame(data)
def color_red_column(col):
return ['background: red' for _ in col]
styled_df = df.style.apply(color_red_column, subset=['A'])
st.table(styled_df)
The result in local:
The result in snowflake:
The formatting is simply ignored.
Thanks so much for the reproducible example! I was able to confirm this myself. Unfortunately, this seems to be due to the limitation of not being able to apply custom CSS in a streamlit app inside of snowflake today. There may be ways to allow that in the future, but for now I don’t think there’s any way to make this work.
Thanks for the info @blackary .
I can’t stress enough how important it is to give format to tables. It makes all the difference between a blur pile of numbers and information that can be grasped in one sight. For me it’s important enough to block me from sharing a dashboard with stakeholders right now.
Now that streamlit is part of Snowflake and even more users are starting to use it in the companies, I hope it can get enough importance to be added.
EDIT: Because with st.table and st.dataframe (it only colours the number) out of the table, is there any other way to present tables with formatting / styling?