I am trying to have a drop-down menu using the selectbox
and then print the first X rows of the dataframe, first starting with a default value and then adapting this value with a slider. This is an exemplary code:
selection = st.selectbox("Select Analysis:", ("", "Dataframe Analysis", "Describe"))
if st.button("Submit"):
if selection == "Dataframe Analysis":
nhead = st.slider("How many rows?", 1, 100, 10)
st.write(dataframe.head(nhead))
The problem is that at the beginning the dataframe is shown with the default number of rows, but as soon as I change the slider value, it disappears and I am reverted back to the select box and the submit button. I am sure I am missing something super simple, but I feel stuck at this problem.
Any help will be greatly appreciated.