Any help to solve the following problem would be appreciated.
I have the following df1:
2020-12-13
user_id currency
4 1WO 1
ADH 23
ALX 5
12223 AMLT 7
ANCT 9
ARE 1
df2:
created_at 2020-12-13
currency
1WO 1
ALX 1
I do the following code:
df1.loc[4] = df1.loc[4].sub(df2, axis=1, level='currency', fill_value=0)
output:
2020-12-13
user_id currency
4 1WO nan
ADH nan
ALX nan
12223 AMLT 7
ANCT 9
ARE 1
output desired
2020-12-13
user_id currency
4 1WO 0
ADH 23
ALX 4
12223 AMLT 7
ANCT 9
ARE 1