Multiselect button crashes app

I’m building an application that allows users to request data and once a dataframe has been created for said request, the user can then select unique instances of filter_playlist and/or filter_artist for further filtering via a multiselect option. However, whenever the user reaches this step, the user can no longer filter the dataframe and is forced to reset the app.

Quick notes:

  • the requested dataframe is the input df
  • ready_button is in the sidebar and it is activated when valid user credentials and URLs are entered
  • I call from multiple files in this application (e.g. proj_analysis) but I don’t think that’s an issue
def alter_dataframe(df):
    if ready_button:
        with st.beta_expander("Interact with Data Frame", True):
            search_filter ='', options=['Filter','Search'])

            if search_filter == 'Filter':
                filter_cols = st.beta_columns((3,3,2))
                filter_playlist = filter_cols[0].multiselect('Playlist', options=np.sort(data['playlist'].unique()))
                filter_artist = filter_cols[1].multiselect('Artist', options=np.sort(data['artist'].unique()))
                filter_release = filter_cols[2].slider('Year Range',
                                                            value = (df['artist_date'].min().year, df['artist_date'].max().year),
                submit = st.button(label='Filter')
                if submit:
                    return proj_analysis.analysis_filter_dataframe(df, filter_playlist, filter_artist, filter_release)

Has anyone experienced something like this before or would know how to troubleshoot this bug? Thanks!

1 Like

Hi @lou_nel, and welcome to the Streamlit forums! :raised_hands:

Have you tried rebooting your app and run it with a smaller dataframe?
Would it be possible to review the full code?


1 Like

Hey @Charly_Wargnier thanks for responding. My most recent files are uploaded to my repo:

  • gathers the data
  • formats the DataFrames
  • generates the plots
  • puts it all together via Streamlit
1 Like

Thanks for these.
Did you try with smaller datasets/dataframes?


Yes - still no luck unfortunately

1 Like

Ok thank you.

Do you get any log trace with it, or is it simply resetting/restarting?


I receive the following output in terminal:

I didn’t consider to look at my Terminal until now - thanks! I’ll look into the AttributeError statement.

I converted wrapped both of the options arguments in list() and that seemed to solve the problem! Let me know if you think of anything else - but thank you for the help!

filter_playlist = filter_cols[0].multiselect('Playlist', options=list(np.sort(data['playlist'].unique())))
filter_artist = filter_cols[1].multiselect('Artist', options=list(np.sort(data['artist'].unique())))
1 Like

Glad it worked! :raised_hands:

Happy Streamlitin’! :balloon:


1 Like