Hello there! I was trying to get the list of column names in my data frame for my selectbox, and I need the date column to be removed from it (the list of column names is [“date”, “name1”, “name2”, etc]). So I assigned the new variable for this and used list.remove() to get rid of “date”. However, when I launch the app it shows the list not as [“name1”, “name2”, “name3”, etc], but as [“name1”, “name1.1”, “name2”, “name3”, etc]. Any ways how to do it correctly? What is the source or this misbehavior?
Code snippet:
df = load_data()
assets_list = df.columns.tolist()
assets_list.remove("date")
option = st.sidebar.selectbox("Select an asset", assets_list)
st.write("you selected", option)
initial data set for assets_list: [“date”, “name1”, “name2”, “name3”, etc]
Expected behavior:
[“name1”, “name2”, “name3”, etc] list
Actual behavior:
[“name1”, “name1.1”, “name2”, “name3”, etc] list
Debug info
- Streamlit version: 1.18.1
- Python version: 3.9.13