I have data frame and target value like this:
target = 'Math'
df:
Col1 Col2
Math Science
Music Math
Social Math
Arts Math
I want to create a new column(New_Col) such that
if Col1 == target i.e Math:
New_Col = Col2 value
else:
New_Col = Col1 value
So the output looks like this:
df:
Col1 Col2 New_Col
Math Science Science
Music Math Music
Social Math Social
Arts Math Arts
Can anyone help me with this?