- Contents
- st.table
- DeltaGenerator.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.
st.table
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, *, border=True, width="stretch", height="content", hide_index=None, hide_header=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. |
border (bool or "horizontal") | Whether to show borders around the table and between cells. This can be one of the following:
|
width ("stretch", "content", or int) | The width of the table element. This can be one of the following:
Row index columns are sticky only when the content overflows a specified integer width. Otherwise, they aren't sticky. |
height ("stretch", "content", or int) | The height of the table element. This can be one of the following:
|
hide_index (bool or None) | Whether to hide the index column. This can be one of the following values:
|
hide_header (bool or None) | Whether to hide the column header row. This can be one of the following values:
|
Examples
Example 1: Display a confusion matrix as a static table
streamlit_app.pyExample 2: Display a product leaderboard with Markdown and horizontal borders
streamlit_app.pyExample 3: Display a scrollable table with fixed height
streamlit_app.pyExample 4: Display key-value data
streamlit_app.pyExample 5: Display a minimal table without index and headers
streamlit_app.py
DeltaGenerator.add_rows
Warning
This method does not exist in version 1.58.0 of Streamlit.
Still have questions?
Our forums are full of helpful information and Streamlit experts.
