【发布时间】:2022-08-20 16:04:33
【问题描述】:
我正在尝试创建显示具有扩展器的 12 列的函数,并且每个扩展器都有一个带表格的多选小部件。
我怎样才能做到这一点 ?
我的代码:
def display_month_list(df,month):
df_test = df.iloc[:;[0,1,2,3]]
option_list = df_test[\"categories\"].unique().tolist()
selected_option = st.multiselect(\"Select Category\",option_list)
if selected_option:
df_test = df_test[df_test[\"categories\"].isin(selected_option)]
st.write(df_test)
col1,col2,col3,col4 = st.columns(4)
col5,col6,col7,col8 = st.columns(4)
col9,col10,col11,col12 = st.columns(4)
with col1:
with st.expander(\"cat1\"):
display_month_list(df,\"cat1\")
with col2:
with st.expander(\"cat2\"):
display_month_list(df,\"cat2\")
等等....
我的问题是如何在每一列中添加这个函数?