I am using streamlit to build a web app that includes a selectbox where the app initialize a dataframe and allow the user to filter this datafarme based on his required criteria then the system display the new datafarme after that the user can select the record from a selectbox that he want to update based on the index number of the new dataframe.
The problem is that when the user select a value from the selectbox the page refresh and nothing is happen.
what i want is to be able to preserve the new dataframe (filtered dataframe) in order to allow the user to select the desired index number.
streamlit version : 0.84
code:
import pandas as pd
import streamlit as st
df_result_search = pd.DataFrame.from_records(rows, columns = [column[0] for column in cursor.description])
if 'count' not in st.session_state:
st.write("you are out of the session")
else:
st.write("you are in the session")
st.dataframe(df_result_search)
df_len = range(len(df_result_search.index))
s = st.selectbox('Select index',options=df_len)
st.write(s)
expander_updates_fields = st.beta_expander('Update Records')
with expander_updates_fields:
for i, col in enumerate(df.columns):
val_update = st_input_update('Update {} from {} to:'.format(col, df[col].values[s]))
expander_updates_fields.markdown(val_update, unsafe_allow_html=True)