My colleague helped me with this. Here is how I finally did it:
s = pandas.Series(['cat dog','hat cat','dog','fog cat','pet'])
searchfor = ['cat', 'dog']
b = ['']*len(s)
for i in numpy.arange(0,len(s)):
for j in numpy.arange(0,len(searchfor)):
b[i] = b[i] + ', ' + searchfor[j] if searchfor[j] in s[i] and b[i]!= '' else (searchfor[j] if searchfor[j] in s[i] else b[i])
df = DataFrame({'s': s, 'searchfor': [numpy.nan if i=='' else i for i in b]})
Df
s searchfor
0 cat dog cat, dog
1 hat cat cat
2 dog dog
3 fog cat cat
4 pet NaN
source
share