Save an editable data frame

Hey Yuval,

My existing code is working with st.session_state[ID_of_data_editor] (i.e. st.session_state[ID_of_data_editor]["added_rows"], "edited_rows" and "deleted_rows") instead of edited_df, which I can not recommend at all!
Instead, directly using the data_editor and triggering st.experimental_rerun should be much simpler. I have bookmarked this post on the topic: Experimental_data_editor column basic calculation - #5 by lim

This is schematically what I would do next time:

st.session_state.persistent_df = ...  # contains the actual data so that it is not lost when the data_editor is edited.
df = st.session_state.persistent_df  # or subset of
edited_df = st.data_editor(df)  # try column_order= to hide additional columns, see: https://docs.streamlit.io/library/api-reference/data/st.data_editor
merge_df(st.session_state.persistent_df, edited_df)

def merge_df(st.session_state.persistent_df, edited_df):
    # merge the two dataframes
    st.experimental_rerun

Hope this helps :slight_smile: