I want to replace the values of one DataFrame with the values of another DataFrame (not necessarily of the same size).
df1:
Ticker A B C D E
Date Symbol
Nov 12 Y Nan 1 Nan 1 1
Dec 1 Y Nan Nan 1 1 1
Dec 5 Y 1 Nan 1 1 Nan
Dec 8 Y Nan Nan 1 1 1
df2:
Ticker A B C D E
Date
Nov 12 12 42 10 15 16
Nov 13 14 45 11 14 18
Nov 14 12 42 19 22 20
... ...
Dec 1 12 46 11 12 17
Dec 5 19 49 13 13 15
Dec 8 11 41 10 15 10
I want to replace the valid values in df1 (i.e.replace the 1's) with the corresponding values from df2. I want to return the following DataFrame:
df3:
Ticker A B C D E
Date Symbol
Nov 12 Y Nan 42 Nan 15 16
Dec 1 Y Nan Nan 11 12 17
Dec 5 Y 19 Nan 13 13 Nan
Dec 8 Y Nan Nan 10 15 10
I have tried to multiply them but df1 is a multiindex. Thank you in advance.