I have two large dataframes, df1:
Col1 Col2 Val1 Val2 Val3
asd ASYL 4.2 4.2
ppq CONE 35 35
DA HU 100 100
And df2 is
Col1 Col2 Val1 Val2 Val3
asd ASYL 7 12 17
ppq CONE 17 19 19
DA HU 5 14 13
Both dataframes have same index columns Col1 and Col2 and same value columns Val1, Val2, Val3.
I want to set the values in df2 to nan where it is Null in df1 to get the following:
Col1 Col2 Val1 Val2 Val3
asd ASYL 7 17
ppq CONE 19 19
DA HU 5 14
I tried the following:
idx = df1.isnull()
df2.loc[idx] = np.nan
But it is not working.
