Hello stackoverflowers!!
I have the following data frame
import numpy as np
import pandas as pd
dataframe = pd.DataFrame({'column1': ['a', 'alike', 'b', 'x', 'a'],
'column2': ['a', 'b', 'c', 'unlake', 'like']})
column1 column2
0 a a
1 alike b
2 b c
3 x unlake
4 a like
And I would like to create another column that has 1 if any of the following strings
check = ['like', 'lake', 'lik']
is in any of the two columns.
I started with this:
any([check1 in dataframe['column1'][1] for check1 in check]) # for one value this works
however when I want to do it for the whole column I do not get the expected result
dataframe[['column1']].apply(lambda row: any((check1 in row for check1 in check)), axis = 1) # this works but does not give the expected
I am propably missing something.
Thanks for the help