Considering the two dataframes
>>> df1
Dr Cr Opening Balance
0 B2 B2 0.0
1 B1 B1 100.0
2 D1 D1 0.0
3 F1 F1 -100.0
>>> df2
Date Amount Dr Cr
0 2021-12-01 452.25 B1 D1
1 2022-01-01 100.00 B1 D1
2 2022-01-02 100.00 B1 D1
I am trying to add a column to df1 which gives the total of Opening Balance + sum of Dr from df2 - sum of Cr from df2
In this case, df1 would become:
>>> df1
Dr Cr Opening Balance Total
0 B2 B2 0.0 0.0
1 B1 B1 100.0 752.25
2 D1 D1 0.0 -652.25
3 F1 F1 -100.0 -100.0
Thanks