import streamlit as st
import pandas as pd

with st.echo("below"):
    
    st.write(
        "Once a single column is selected, there is no going back. You can add a second in the multiselct, but it won't change anything. Rerunning does not help. Your only hope is to refresh the page."
    )
    
    df = pd.DataFrame(data=[[1, 4, 7], [2, 5, 8], [3, 6, 9]], columns=["a", "b", "c"])

    st.subheader("original dataframe")
    st.write(df)

    columns = st.multiselect(label="Select columns to average", options=df.columns)
    df["Average"] = df[columns].mean(axis=1)

    st.subheader("dataframe with average column")
    st.write(df)

    
    
