Hi, I am using Streamlit in Snowflake (v1.22.0):
What I am trying to do is to apply a multiselect widget with unique labels list that will filter the dataframe BUT the labels rows can contain more than 1 value from the list (array of strings/list)
(also could be understood as tags)
The labels
column can look like this (as an example):
v10, v11, v12, v13
v11, v12, abc
v13, def
v10, v13, abc
I also tried to swich is to array with df['LABELS'].str.split(',')
For the multiselect widget I chose only the unique values in the column
df_label_unique = ['v10', 'v11', 'v12', 'v13', 'abc', 'def']
select_labels = st.multiselect('Labels ', options=df_label_unique, default=[])
I am having troubles with applying the mutliselect to filter the dataframe and also combine it with other multiselect widgets.
Basically I think I need to compare values in 2 arrays/lists and filter based on the result
What I have tried so far:
df_test1 = df[df['LABELS'].str.contains(select_labels)]
df_test2['LABELS'].apply(lambda x: select_labels[0] in x)
this works but only for the 1st selected element in the widget
and much more…but nothing seems to work
for other multiselects I am using this: (because there is only 1 value per row)
df_filter = df[df['COLUMN'].isin(selected_filter)]
If it helps I know that in Snowflake I would use LIKE ANY
select labels
from table
where labels like any('%v11.x%', '%v14.x%')
Thank you for any help in advance
Jana