Conditional column format on dataframe

Hello,

I have a DataFrame with a column named “Exist”, which contains either None or True values. I’d like to display this DataFrame in Streamlit, showing a green checkmark when the value is True, and a red cross when it’s None.

import streamlit as st
import polars as pl

df = pl.DataFrame({
    "Product" : [1,2,3],
    "Exist": [True, None, None]
    
})
col_config = {
    "Exist": st.column_config.NumberColumn(format="✅"),
}
st.dataframe(df,column_config=col_config)

This is my current approach. I’m able to display the checkmark, but I’d like to add the condition for showing the red cross as well. Any advice?

You could always create a new text column to display in place of the current Exist column while hiding the Exist column.