df=pd.DataFrame({'sym':['A', 'B', 'C', 'D'],'event':[['1','2', '3'], ['1'], ['2', '3'],['2']]} )
df
sym event
0 A [1, 2, 3]
1 B [1]
2 C [2, 3]
3 D [2]
Event column is made up of lists of strings. I am trying to filter the event column for any rows that contain '3' so I am looking for index 0 and 2.
I know to use
["3" in df.event[0]]
for each row and I think a lambda function would push me over the finish line.
df[df.event.astype(str).str.contains('3')]? Or whats your desired output?