Function signature | |
---|---|
st.dataframe(data=None, width=None, height=None) | |
Parameters | |
data (pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict, or None) | The data to display. If 'data' is a pandas.Styler, it will be used to style its underyling DataFrame. Streamlit supports custom cell values and colors. (It does not support some of the more exotic pandas styling features, like bar charts, hovering, and captions.) Styler support is experimental! 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". |
width (int or None) | Desired width of the UI element expressed in pixels. If None, a default width based on the page width is used. |
height (int or None) | Desired height of the UI element expressed in pixels. If None, a default height is used. |
Examples
df = pd.DataFrame( np.random.randn(50, 20), columns=('col %d' % i for i in range(20))) st.dataframe(df) # Same as st.write(df)(view standalone Streamlit app)st.dataframe(df, 200, 100)You can also pass a Pandas Styler object to change the style of the rendered DataFrame:
df = pd.DataFrame( np.random.randn(10, 20), columns=('col %d' % i for i in range(20))) st.dataframe(df.style.highlight_max(axis=0))(view standalone Streamlit app)