It is necessary to obtain the names of the columns in a list or a new DataFrame by allowing the user to select them through mouse clicks from the st.dataframe. This selection will facilitate the creation of a new st.dataframe based on the columns chosen by the user.
You can enable column selection with st.dataframe. Use on_select="rerun" in st.dataframe. Set selection_mode to either "single_column" or "multi_column" depending on what you want. Examples of getting selections from dataframes are included in the docs: st.dataframe - Streamlit Docs
I appreciate your prompt response, boss. I attempted to use the sample link you provided; however, it only allows for the selection of series columns sequentially. What I require is the ability to select random columns, such as A, C, F, J, and K, rather than in a series like A, B, C, D. My users should be able to select the desired columns by clicking with the mouse, which would then generate a new DataFrame containing only the randomly selected columns. After selecting the columns, users will then choose the rows. I hope this clarifies my requirements.
Thank you very very much for your valuable reply
thank you again and again

