I have the following dataframe:
df=
product_name 0 1 2
0 laptop 1200 1000 100
1 printer 150 10 100
2 tablet 300 30 560
3 desk 450 40 640
4 chair 200 20 207
I want to add the sum of column 1 and 2 but with multiplying the column 1 with 0.7 and 2 by 0.3.
I tried to make the sum for these 2 columns like:
df[[1, 2].sum(axis = 1)
I can do like that
df['Value'] = df.apply(lambda cols: cols[1]*0.7+cols[2]*0.3, axis=1)
But I am looking to send the 0.7 and 0.3 as parameter not hard coded.