If I want to filter a column of strings for those that contain a certain term I can do so like this:
df = pd.DataFrame({'col':['ab','ac','abc']})
df[df['col'].str.contains('b')]
returns:
col
0 ab
2 abc
How can I filter a column of lists for those that contain a certain item? For example, from
df = pd.DataFrame({'col':[['a','b'],['a','c'],['a','b','c']]})
how can I get all lists containing 'b'?
col
0 [a, b]
2 [a, b, c]