This is the following subset of a dataset:
A B C D R sentence ADR1 ADR2
112 135 21 EffexorXR.21 1 lack of good feeling. good feeling
113 135 21 EffexorXR.21 1 1
115 136 21 EffexorXR.21 2 Feel disconnected disconnected feel
116 136 21 EffexorXR.21 2 0
118 142 22 EffexorXR.22 1 Weight gain gain
119 142 22 EffexorXR.22 1 1
In column ADR1 and ADR2, for each word, there should be 1 or 0 in the row blow it. if the value is missing, I need to replace it with "0". This is the output:
A B C D R sentence ADR1 ADR2
112 135 21 EffexorXR.21 1 lack of good feeling. good feeling
113 135 21 EffexorXR.21 1 1 0
115 136 21 EffexorXR.21 2 Feel disconnected disconnected feel
116 136 21 EffexorXR.21 2 0 0
118 142 22 EffexorXR.22 1 Weight gain gain
119 142 22 EffexorXR.22 1 1
I tried
df[ADR1].fillna(0, inplace=True) and df[ADR2].fillna(0, inplace=True)
but this code produce the following df, which is not wanted
A B C D R sentence ADR1 ADR2
112 135 21 EffexorXR.21 1 lack of good feeling. good feeling
113 135 21 EffexorXR.21 1 1 0
115 136 21 EffexorXR.21 2 Feel disconnected disconnected feel 0
116 136 21 EffexorXR.21 2 0
118 142 22 EffexorXR.22 1 Weight gain gain 0
119 142 22 EffexorXR.22 1 1 0