Hello. I am trying to display dataframes with custom styles(like background color) and the following code works fine:
def color_negative_red(value):
color = 'red' if value < 500 else 'green'
return f'background-color: {color}'
styled_df = df.style.applymap(color_negative_red)
st.dataframe(styled_df)
But when I try to replace st.dataframe with st.data_editor, I got the following error:
2024-08-16 15:38:15.541 Uncaught app exception
Traceback (most recent call last):
File ".conda\envs\data\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 589, in _run_script
exec(code, module.__dict__)
File "test.py", line 35, in <module>
column_config={
File "test.py", line 36, in <dictcomp>
str(i): st.column_config.Column(
File ".conda\envs\data\lib\site-packages\streamlit\runtime\metrics_util.py", line 408, in wrapped_func
result = non_optional_func(*args, **kwargs)
TypeError: Column() got an unexpected keyword argument 'cell_style'
I didn’t find Python API for styling in st.data_editor and st.column_config. Are there any other approaches to style st.data_editor?