St.data_editor removes data frame after editing?

Summary

I have loaded a dataframe into the st.data_editor ok. When I edit the data in any column, the table suddenly disappears…

Steps to reproduce

Code snippet:

          st.write("People Search Results")

          # Create a DataFrame
          df = pd.DataFrame(people_data,
                            columns=['Name', 'Title', 'LinkedIn URL'])
          # Add an "Enrich" column with unchecked checkboxes
          df.insert(0, 'Enrich',
                  [False] * len(df))  # Insert at the first position

          # Display the editable dataframe
          st.data_editor(df, key="data_editor", hide_index=True)

          # Check for changes in the session state
          # changed_data = st.session_state.get("data_editor", {})
          st.write(st.session_state["data_editor"])  # Debug print

Expected behavior:

I expect the table to stay on the page and the amended rows to appear underneath where I’m writing them.

Actual behavior:

The table/data disappears…

Debug info

  • Streamlit version: 1.23
  • Python version: 3.10.8

Requirements file

streamlit==1.23.0
pandas
requests
stripe
peopledatalabs