I have a data frame such as
query subject col1
A dog ok
B cat okl
C cat oklp
D frog ok
E cat ok
F fox ok
and a file.txt such as:
dog
cat
and the idea is to only keep row that have a pattern present in the file.txt. Here I should get :
query subject col1
A dog ok
B cat okl
C cat oklp
E cat ok
I tried with :
file = open('file.txt').read()
df=[]
for row in tab['subject']:
if row in file:
row.append(df)
but it does not seem to be the solution, thank you for your help.