import pandas as pd import streamlit as st def drop_columns(df, columns): df.drop(columns, axis=1, inplace=True) return df def reload_data(): st.write("Reloading data...") df_original = st.session_state["df_original"] df = df_original.copy() st.session_state.df = df del st.session_state['df_target'] del st.session_state['best'] st.experimental_rerun() st.set_page_config(layout='wide') col1, col2, col3 = st.columns([15, 70, 15]) with col1: st.write('') with col2: if 'df' not in st.session_state: st.warning('Please upload a CSV file') else: st.header('Missing Values') if st.button('Reload data'): reload_data() df = st.session_state['df'] # show all columns names st.dataframe(df.head()) columns = df.columns.tolist() # create a multiselect to select the columns to drop columns_to_drop = st.multiselect('Select the columns to drop', columns) # create a button to drop the columns if st.button('Drop columns'): df = drop_columns(df, columns_to_drop) st.dataframe(df.head()) st.session_state.df = df st.success('Columns dropped') st.experimental_rerun() with col3: st.write('')