I have the following data frame about registered vehicles in Switzerland:
Fuel Year Region Count
Gasoline 2013 GE 169600
Diesel 2013 GE 46790
Hybrid 2013 GE 2268
Electric 2013 GE 85
Other 2013 GE 532
Gasoline 2013 VS 149232
Diesel 2013 VS 50591
Hybrid 2013 VS 1028
Electric 2013 VS 268
Other 2013 VS 261
I would like to add an additional "Pct" column in the data frame with the percentage of the fuel type by year and region but I have some difficulties to understand how. The result should be:
Fuel Year Region Count Pct
Gasoline 2013 GE 169600 0.7734
Diesel 2013 GE 46790 0.2134
Hybrid 2013 GE 2268 0.0134
Electric 2013 GE 85 0.0004
Other 2013 GE 532 0.0024
Gasoline 2013 VS 149232 0.7410
Diesel 2013 VS 50591 0.2512
Hybrid 2013 VS 1028 0.0051
Electric 2013 VS 268 0.0013
Other 2013 VS 261 0.0013