Append data to a table or chart

In Streamlit, you can not only replace entire elements in your app, but also modify the data behind those elements. Here is how:

import numpy as np import time # Get some data. data = np.random.randn(10, 2) # Show the data as a chart. chart = st.line_chart(data) # Wait 1 second, so the change is clearer. time.sleep(1) # Grab some more data. data2 = np.random.randn(10, 2) # Append the new data to the existing chart. chart.add_rows(data2)
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.

Was this page helpful?

editEdit this page on GitHub