I have the below df. Need to the replace the Value of 'Numerical' with a calculation as '4% of the Type_1' when 2 conditions are met: Type = Type_2 and the Numerical is > 0
df_in = pd.DataFrame([['Jan-2021','P_1','Type_1','5'],['Jan-2021','P_1','Type_2','10'],['Jan-2021','P_1','Type_3','15'],
['Feb-2021','P_1','Type_1','7'],['Feb-2021','P_1','Type_2','0'],['Feb-2021','P_1','Type_3','21'],
['Mar-2021','P_2','Type_1','3'],['Mar-2021','P_2','Type_2','6'],['Mar-2021','P_2','Type_3','9']],
columns = ['Month-Yr','Product','Type','Numerical'])
Month-Yr Product Type Numerical
0 Jan-2021 P_1 Type_1 5
1 **Jan-2021 P_1 Type_2 10**
2 Jan-2021 P_1 Type_3 15
3 Feb-2021 P_1 Type_1 7
4 **Feb-2021 P_1 Type_2 0**
5 Feb-2021 P_1 Type_3 21
6 Mar-2021 P_2 Type_1 3
7 **Mar-2021 P_2 Type_2 6**
8 Mar-2021 P_2 Type_3 9
Expected result:
Month-Yr Product Type Numerical
0 Jan-2021 P_1 Type_1 5
1 **Jan-2021 P_1 Type_2 0.2**
2 Jan-2021 P_1 Type_3 15
3 Feb-2021 P_1 Type_1 7
4 Feb-2021 P_1 Type_2 0
5 Feb-2021 P_1 Type_3 21
6 Mar-2021 P_2 Type_1 3
7 **Mar-2021 P_2 Type_2 0.12**
8 Mar-2021 P_2 Type_3 9