I got a data frame with multiple rows like this:
N amount country codeA codeB
0 -15678 NAN CH US
1 3475 NAN POL FR
How can I select column codeA for the value of country when the amount is negative and codeB when positive
I would like to have something like this as output
N amount country codeA codeB
0 -15678 CH CH US
1 3475 FR POL FR