I have for example 2 columns in my Dataframe
A B
0 4 True
1 3 False
2 4 False
3 3 True
And I now want to add 1 to the value in A if B is True
and subtract 2 if B is False
.
Is there a clean way to put this in an if without looping through all rows? What I really want to do is a bit more complicated than subtracting and adding but I simplified it here for the question. So I am happy about not super short answers specified to adding 1 and subtracting 2.
Hope someone can help me :)