I have a Pandas dataframe:
id attr
1 val1
2 val1||val2
3 val1||val3
4 val3
and a list special_val = ['val1', 'val2', 'val4']
I want to filter the first dataframe to keep rows whose ALL attr values are in the list. So I need the results to be like this:
id attr
1 val1 #val1 is in special_val
2 val1||val2 #both val1 and val2 are in special_val
I am thinking of using pandas.DataFrame.isin or pandas.Series.isin but I can't come up with the correct syntax. Could you help?