How can I multiply values in one column by other columns containing numerical data? Suppose a dataframe df_1
is given by
df_1 = DataFrame(NAME = ["Aa","Bb","AB","CD","EF","GH"], SCORE=[0,1,10,20,30,45], VALUE =[400,200,400,600,10,20],
INCOME = [123,56,90,1000,50,60], GAIN =[55,65,111,65,34,100])
I would like to produce equivalent to df_2
that multiplies values in the column SCORE
with the remaining columns
df_2 =DataFrame(NAME = ["Aa","Bb","AB","CD","EF","GH"], SCORE=[0,1,10,20,30,45],VALUE=df_1.SCORE.*df_1.VALUE,
INCOME = df_1.SCORE.*df_1.INCOME, GAIN =df_1.SCORE.*df_1.GAIN)
I have tried using this, but it doesnβt work.
df_2 = names(df_1,Not(Between(:NAME,:SCORE)) .=>*:SCORE)