Update a dataframe widget which is editable with st.data_editor

If someone could help me out with updating my widget that is a dataframe using st.data_editor. Once the user makes the changes in the widget dataframe, it gets pushed to my database when st.button(“Update Selected Name”) is clicked. I would like to show the updated dataframe in the st.data_editor widget after the button is clicked. The logic after the button is pressed is long and complex. I want the updated dataframe to be displayed after I press st.button

if filtered_kirana_appsmith.empty:
        update = kirana_appsmith.copy()
        st.write(f"Number of Rows: {len(filtered_kirana_appsmith)}")
        st.write("No data available for selected filter(s).")
    else:
        update = st.data_editor(filtered_kirana_appsmith[display_order], hide_index=True)        
        st.write(f"Number of Rows: {len(filtered_kirana_appsmith)}")

selected_name = st.selectbox("Select Assigned To -Name", options=[None] + appsmith['name'].dropna().unique().tolist())

if st.button("Update Selected Name"):
        # Name and ID mapping
        name_to_id_mapping = appsmith.drop_duplicates('name').fillna({'name': np.nan}).set_index('name')['id']

        selected_shop = diff_rows[diff_rows['Selected Shops']==True]
        not_selected_shops = diff_rows[diff_rows['Selected Shops']==False]