I need to compare values from 2 different columns in my data frame and set the value of another column in the same data frame.
The conditions being:
If First Character of value in Column "code" = "V" and column "event_date" is not NULL
Set Value of Label Column = 1
Else
Set Value of Label Column = 0
Here is my code
data1['label'] = np.where((data2['code'].str.slice(0, 1)=='V') & (data2['event_Date'].notnull), 1, 0)
This does not seem to be working.
Please help.