- Contents
- st.table
- element.add_rows
Tip
Static tables with st.table
are the most basic way to display dataframes. For the majority of cases, we recommend using st.dataframe
to display interactive dataframes, and st.data_editor
to let users edit dataframes.
Display a static table.
While st.dataframe is geared towards large datasets and interactive data exploration, st.table is useful for displaying small, styled tables without sorting or scrolling. For example, st.table may be the preferred way to display a confusion matrix or leaderboard. Additionally, st.table supports Markdown.
Function signature[source] | |
---|---|
st.table(data=None) | |
Parameters | |
data (Anything supported by st.dataframe) | The table data. All cells including the index and column headers can optionally contain GitHub-flavored Markdown. Syntax information can be found at: https://github.github.com/gfm. See the body parameter of st.markdown for additional, supported Markdown directives. |
Examples
Example 1: Display a simple dataframe as a static table
Example 2: Display a table of Markdown strings
Function signature[source] | |
---|---|
element.add_rows(data=None, **kwargs) | |
Parameters | |
data (pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, Iterable, dict, or None) | Table to concat. Optional. |
**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). |
Example
You can do the same thing with plots. For example, if you want to add more data to a line chart:
And for plots whose datasets are named, you can pass the data with a keyword argument where the key is the name:
Still have questions?
Our forums are full of helpful information and Streamlit experts.