nielsr HF staff commited on
Commit
d54e190
1 Parent(s): 99a2513

Fix bug thanks to claude-3.5-sonnet

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -58,11 +58,10 @@ def show_data_editor(filtered_df: pd.DataFrame, key: str):
58
  key=key)
59
 
60
  if edited_df is not None and not edited_df.equals(filtered_df):
61
- # update the df of the session state with the affected rows
62
- # TODO there seems to be a bug in here
63
- original_df = st.session_state.df
64
- original_df.update(edited_df)
65
- st.session_state.df = original_df
66
 
67
 
68
  def display_data(filtered_df: pd.DataFrame):
 
58
  key=key)
59
 
60
  if edited_df is not None and not edited_df.equals(filtered_df):
61
+ main_df = st.session_state.df
62
+ edited_indices = edited_df.index
63
+ main_df.loc[edited_indices] = edited_df.loc[edited_indices]
64
+ st.session_state.df = main_df
 
65
 
66
 
67
  def display_data(filtered_df: pd.DataFrame):