Update DataFrame

I have a data frame displayed at the top of my app. Later on, by using a button the data frame gets updated. Is there any way to update this data frame at the top of the page to display the changed information? Or equally, is there any code that can be added to the button to force a page refresh?
Thanks in advance!

Hi @jackmleitch, welcome to the Streamlit community.

You can append data to a dataframe using the add_rows method:


This will trigger the page to refresh the object to include the new data.


Are there plans to add a similar function to drop rows/columns from the dataframe?

1 Like

I wish the dataframe update API is better designed. Usually when the dataframe is updated, the display table must automatically update itself and be able to be updated through a command. The current way is complex and also doesnt work well. Here is an example:

test_df = instantiate a dataframe with columns.
test_table = st.sidebar.table(test_df)

with ___:
start to add dataframe row by row

test_table does not update on its own or even on a button press

Yeah I also wish that there was a command like update_dataframe.
I need to display a dataframe where the user can delete rows via a button or another way (delete key for example).
Any thoughts on this?

Hi @harishkashyap, @jackmleitch and @fabmeyer , I used AGgrid on a pandas dataframe to implement the edit / update functionality. Do check if this works for you. You will need a sample CSV with Name & Amt columns containing a few entries to test this. You will also need to change the path.

Here’s the link: Ag-Grid component with input support - #236 by Shawn_Pereira

The delete rows functionality has been done by @sis . The link is here: Ag-Grid component with input support - #171 by sis


1 Like

Hello guys, maybe this will not in dynamic way. But here may be one of your solution.
Make some button, then using “if” to reload the page if user click the button.
For example:
if st.button(“Update Data”):

Hope it’s helpfull