import streamlit as st
import pandas as pd
df = pd.DataFrame({"col": ["foo", "baz", "qux"]})
st.data_editor(df, key="OK")
if st.button("Show another df"):
st.data_editor(df, key="KO")
import streamlit as st
import pandas as pd
df = pd.DataFrame({"col": ["foo", "baz", "qux"]})
st.data_editor(df, key="OK")
runbtn = st.button("Show another df")
if "runbtn_state" not in st.session_state:
st.session_state.runbtn_state = False
if runbtn or st.session_state.runbtn_state:
st.session_state.runbtn_state = True
st.data_editor(df, key="KO")
1条答案
按热度按时间juud5qan1#
我不知道是否有更简单的方法,但@Jamiu S。answer解决了我的问题。