I want to use the rows selected in my st.dataframe to filter my data. I’m using the new feature in streamlit 1.35. I’m running my app locally .
Snippet of my code:
def click_df_resumo():
if ‘df_resumo’ not in st.session_state:
st.session_state.df_resumo = None
df_resumo = st.session_state.get(‘df_resumo’)
selection = df_resumo.get(‘selection’) if df_resumo else None
rows = selection.get(‘rows’) if selection else None
if rows:
lin = rows
dados_filter = dados.iloc[lin]
else:
dados_filter = dados
st.dataframe(df_tabela, hide_index=True, use_container_width=True, on_select=click_df_resumo, selection_mode=‘multi-row’, key=‘df_resumo’)
But when i run the script, i get the error:
StreamlitAPIException: Values for st.button, st.download_button, st.file_uploader, st.data_editor, st.chat_input, and st.form cannot be set using st.session_state.
But if i change the on_select to ‘ignore’ and then change back to my function, it works perfectly.
To me, this error don’t make any sense because i’m using st.dataframe and not st.data_editor