Got the Following Dataframe:
A B
Temp1 1
Temp2 2
NaN NaN
NaN 4
Since the A nad B are correlated, I am able to create new column where I have calculated the nan value of A and B and form a tuple:
A B C
Temp1 1 (1,Temp1)
Temp2 2 (2, Temp2)
NaN NaN (3, Temp3)
NaN 4 (4, Temp4)
Now I have to drop the column C and fill the Nan value corrosponding to the Columns.
Use
Series.fillna
with select values in tuple by indexing withstr
, last removeC
column:Or create DataFrame from
C
withDataFrame.pop
for use and remove column, set new columns names and pass toDataFrame.fillna
: