I have a dataframe like this:
col1 col2 col3
| a | 1 | 2 |
What I want to do is map each row to replace the col3
with this function
def winner (col2, col3, col1):
if(col1 == "a"):
return col2
elif(col1 == "D"):
return col3
else:
return "X"
I tried to map but I can't
Output:
col1 col2 col3
| a | 1 | 1 |
Can anybody help me?