With the following DF:
A B
0 a 1
1 b 2
2 NaN 1
3 NaN 2
I would like to replace NaN values of A
based on the numeric representation of B
, to get:
A B
0 a 1
1 b 2
2 a 1
3 b 2
I've built a dictionary of B/A values: {1 : 'a', 2: 'b'}
How can I apply the change to the NaN values?