I have two pandas data frames like below. The column 'No' is a common field. Based on 'No', i want to replace values in first data frame column 'Total'.
Condition is : Where ever 'No' matches, get 'Marks1' value from dataframe2 and replace in 'Total' column. If 'Marks1' is NULL, then get 'Marks2' value and replace in 'Total'. If both (Marks1/Marks2) are null, replace with null in the 'Total' column. The final result should be in data frame1. Both data frames has few hundred thousand records.
Data frame1
No|Total
1234|11
2515|21
3412|32
4854|
7732|53
Data frame2
No|Marks1|Marks2
1234|99|23
2515|98|31
3412||20
4854||98
7732||
Result :
No|Total
1234|99
2515|98
3412|20
4854|98
7732|