I am trying to divide every two columns by the last two columns in the data set. For example, I want to divide column[0] and column[2] by column[-2] and then store the result in column[0] and column[2], respectively.
Ideally, what I want is to obtain from this:
fra1 ger1 fra2 ger2 fra pop ger pop
0 12 14 525 52 14 14
something like this:
fra1 ger1 fra2 ger2
0 12/fra pop 14/ger pop 525/fra pop 52/ger pop
that is, I want to create a new Dataframe (that keeps the original column labels) by dividing values of each country by its population. Doing this manually for every column would take too much time with the real dataset, and I cannot figure out how to run a loop.
Can anybody help? Thanks a lot!