Hi @randyzwitch thank you so much for answer.
You can see here a snippet of my code
with st.beta_expander('Grafical distribution of the columns', expanded=False):
fig_hist, ax = plt.subplots(figsize=(50, 30))
ax.xaxis.set_major_formatter(plt.FuncFormatter(format_func))
ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func))
df.hist(bins=30, color='r', ax=ax, xrot=90)
fig_hist.tight_layout()
st.pyplot(fig_hist, clear_figure=True)
with st.beta_expander('Explore Categorical Columns', expanded=False):
fig_count = plt.figure(figsize=[25, 12])
hue_column = None
column = st.selectbox('Choose Column', ['<select>'] + df.columns.tolist())
if not column == '<select>':
a = sns.countplot(x=column, hue=hue_column, data=df)
a.set_xlabel(f'{column}', fontsize=24)
a.set_ylabel(f'Count', fontsize=24)
st.pyplot(fig_count, clear_figure=True)
In my use case scenario, moreover to show a distribution of the columns dataframe, I want to show a count plot of the categorical columns. So my problem comes when an user choose an specific column, the whole page will rerun, producing a terrible user experience. Most probably I am making a bad use of it
Again thank you for your answer