Say I have a DF defined as variable DF1:
Words Score The man 10 A Plan 20 Panama 30 And say I have a function:
def func(w, df): pattern = re.compile(r'\b({0})\b'.format(w), flags=re.IGNORECASE) if pattern.search(df): return True else: return False How do I pass each row of DF1, specifically the columns 'Words', to the argument within the function?
EDIT: Ubuntu's answer is what I would normally use but I need to self reference the DF in my function