quick question. Is there a way preserve a pandas dataframe while using SessionState?
I copyed the file (“sessionState.py”) into my project and load it.
However, if I do an update for one row of the dataframe, the previous values get lost.
state = SessionState.get(df=pd.DataFrame(), index =0)
if st.button("Next"): state.df.at[state.index, 'Added Values'] = 1 state.index += 1
than it says that 0 parameters were required but one given.
Also state.snyc() does not work. Something is odd here.
Further, when I copy your code from the gist and do
state = _SessionState() I get:
TypeError: init() missing 2 required positional arguments: ‘session’ and ‘hash_funcs’
Please use the get_state function to get the state.
I like to use a small decorator that I wrote that takes care of get_state and sync state.
Check this out,