Spaces:
Runtime error
Runtime error
File size: 614 Bytes
dd0ef30 9c1ffe9 dd0ef30 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import pandas as pd
import streamlit as st
# Cache the dataframe so it's only loaded once
@st.cache_data
def load_data():
return pd.DataFrame(
{
"first column": [1, 2, 3, 4],
"second column": [10, 20, 30, 40],
}
)
# Boolean to resize the dataframe, stored as a session state variable
st.checkbox("Use container width", value=False, key="use_container_width")
df = load_data()
# Display the dataframe and allow the user to stretch the dataframe
# across the full width of the container
st.dataframe(df, use_container_width=st.session_state.use_container_width)
|