I want my app to update everytime data is uploaded with st.file_uploader
. It seems to do this only when a completely new file (or file with different name) is uploaded but not when the same file (or file with same name) is uploaded. In my app, the user will upload a csv and edit it with st.data_editor. I want him to be able to reupload the same file to start over if necessary. The following code illustrates the problem:
import streamlit as st
import pandas as pd
uploaded_file = st.file_uploader(label="Upload CSV", type="csv")
if uploaded_file is not None:
df = pd.read_csv(uploaded_file)
df_new = st.data_editor(df, num_rows="dynamic")
For the data, I am using the following data.csv
contents:
col_1,col_2
1,2
3,4
5,6
7,8
I want the data in the st.data_editor to be reset every time the user uploads data.csv . Right now, if I edit the dataframe (say by deleting a row), then upload the data again, nothing changes.