I have a Pandas dataframe and one of the columns is a string. I imported a function from an external module to do some RegEx checking and reduce this string to a short classification.
This works:
df['PageCLass'] = df['PageClass'].apply(lambda x: PageClassify.page_classify(x))
However what I would really like to do is incorporate another column 'Rev' in the dataframe which happens to be either be a float or NaN into the checking.
When I did this:
df['PageCLass'] = df['PageClass'].apply(lambda x: PageClassify.page_classify(x,df['Rev']))
and I was doing logical checks inside the classification function on the 2nd argument, I got this error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
What I am looking for is a way to capture the 2nd argument value by value, just as lambda x: captures the first argument value by value.