I have a problem with comparing columns two dataframes.
def function():
x = {'col1': ['first', 'second'], 'col2': [[1,4,5], [3,6]]}
y = {'col1': ['X', 'Y', 'Z'], 'col2': [1, 2, 3]}
df1 = pd.DataFrame(data=x)
df2 = pd.DataFrame(data=y)
How can I check if values from df2['col2'] are in df1['col2']?
I would like to get a a new dataframe which will looks like this
col1 col2 new_col
0 X 1 first
1 Y 2 FALSE/ NaN (etc.)
2 Z 3 second
My problem is that I don't know how to compare single element, in real data it is domain_name, to list of domain_names.