Mutate charts

Sometimes you display a chart or dataframe and want to modify live as the app runs (for example, in a loop). Depending on what you're looking for, there are 3 different ways to do this:

  1. Using st.empty to replace a single element.
  2. Using st.container or st.columns to replace multiple elements.
  3. Using add_rows to append data to specific types of elements.

Here we discuss that last case.

Concatenate a dataframe to the bottom of the current one.
Function signature

element.add_rows(self, data=None, **kwargs)


data (pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict, or None)

Table to concat. Optional. Pyarrow tables are not supported by Streamlit's legacy DataFrame serialization (i.e. with config.dataFrameSerialization = "legacy"). To use pyarrow tables, please enable pyarrow by changing the config setting, config.dataFrameSerialization = "arrow".

**kwargs (pandas.DataFrame, numpy.ndarray, Iterable, dict, or None)

The named dataset to concat. Optional. You can only pass in 1 dataset (including the one in the data parameter).

Was this page helpful?

editSuggest edits

Still have questions?

Our forums are full of helpful information and Streamlit experts.