I am trying something I think is simple, however I keep getting errors and I don't know why.
I am trying to set a value in a new column for df2. If value is column from df2 matches any value from df1 "col", then write "result", otherwise "no result".
#Create a series from df column
series_from_df = df1['Col']
df2['new_col'] = 'result' if df2['Col1'].isin(series_from_df) else 'Not result'
The above gets me an error:
(<class 'ValueError'>, ValueError('The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().'), <traceback object at 0x7f9081a28f80>)
Then I try the below adding the square brakes for series_from_df
#Create a series from df column
series_from_df = df1['Col']
df2['new_col'] = 'result' if df2['Col1'].isin([series_from_df]) else 'Not result'
I get the same error than before.
What am I missing?