I have the dataframe like:

year Pa Qa Pb Qb Pc Qc ...
1
2
3
...

How do I create the Paasche index for each year. Particularly, I would like to know how to generate the weighted sum of Pit * Qit and Pit * Q0t at a particular year.