I have some data that has 11 columns. I need to multiply columns 1-10 by column 11 and then create 10 new columns with those results. To do this I am using pandas DataFrame.
Now I understand how to do this for each column individually with a code like this
df['newcolumn1'] = df['column1']*df['column11']
df['newcolumn2'] = df['column2']*df['column11']
df['newcolumn3'] = df['column3']*df['column11']
I'm assuming I can set up a function and a loop to iterate through the columns and create the new columns. Is there anyway I can do this by referencing the column index number instead of the column names.