I am building an streamlit app. I put check box which indicates to each Data Frame. Then if the check box is clicked, concat all the relevant Data Frames.
for instance if option 1 and 2 are clicked, I want to concat only dataframe 1 and 2.
I wrote some piece of code which I can not get the final result, can anyone help to modify the code?
option_1 = st.sidebar.checkbox('dataframe1 ')
option_2 = st.sidebar.checkbox('dataframe2 ')
option_3 = st.sidebar.checkbox('dataframe3 ')
option_4 = st.sidebar.checkbox('dataframe4 ')
dic = {"option_1":"dataframe_1 ", "option_2" :"dataframe_2 ",
         "option_3":"dataframe_3 ", "option_4": "dataframe_4 ",
        }
df = None
for key, val in dic.items():
    if option_1 or option_2 or option_3 or option_4:
df = pd.concat([dataframe_1,dataframe_2,dataframe_3,dataframe_4])
else:
    None
My another try:
df = None
list2 = []
for key, val in dic.items():
    st.write(key)
    if option_1 or option_2 or option_3 or option_4 :
        list2.append(val)
        st.write(list2)
        for i in list2:
            df = pd.concat(i)
    else:
        None
 
     
    