These Streamlit snippets demonstrate various functionalities:
Replace any single element:
element = st.empty()
creates an empty placeholder element.
element.line_chart(...)
replaces the empty element with a line chart.
element.text_input(...)
replaces the previous element with a text input field.
Insert out of order:
elements = st.container()
creates a container for elements.
elements.line_chart(...)
inserts a line chart into the container.
st.write("Hello")
writes "Hello" outside of the container.
elements.text_input(...)
appears above "Hello" within the container.
Other Streamlit functions:
st.help(pandas.DataFrame)
displays help information for the Pandas DataFrame.
st.get_option(key)
retrieves the value of a Streamlit option.
st.set_option(key, value)
sets the value of a Streamlit option.
st.set_page_config(layout='wide')
sets page configuration options like layout.
st.experimental_show(objects)
displays experimental Streamlit objects.
st.experimental_get_query_params()
retrieves query parameters from the URL.
st.experimental_set_query_params(**params)
sets query parameters in the URL.