I have a df like this:
frame = pd.DataFrame({'a' : ['a,b,c', 'a,c,f', 'b,d,f','a,z,c']})
And a list of items:
letters = ['a','c']
My goal is to get all the rows from frame that contain at least the 2 elements in letters
I came up with this solution:
for i in letters:
subframe = frame[frame['a'].str.contains(i)]
This gives me what I want, but it might not be the best solution in terms of scalability. Is there any 'vectorised' solution? Thanks
