I can do a single word search in each column but unable to search user-provided number of string search with "and" "or" option
0 1 3 4
0 [OH-] [Na+] NAN CCO
1 [OH-] [Na+] CCO Cl
This one works
search = 'CCO'
df.loc[df.isin([search]).any(axis=1)].index.tolist()
For multi-search I tried
import re
terms = ['C1', 'CCO']
p = r'\b(?:{})\b'.format('|'.join(map(re.escape, terms)))
df[df['col'].str.contains(p)]
Gives me KeyError: 'col'
Expected output
Search='C1' AND '[NA+]
Results 1
Search='CCO' OR 'C1'
Results 0 1