How to compute weighted average
问题 Country life_expectancy population Germany 70 3000000 France 75 450000 USA 70 350000 India 65 4000000 Pakistan 60 560000 Belgium 68 230000 I want to calculate the weighted average life expectancy according to the formula below: ∑ (𝑙𝑖𝑓𝑒𝑖 × 𝑝𝑜𝑝𝑖)/ ∑ 𝑝𝑜𝑝𝑖 where 𝑙𝑖𝑓𝑒𝑖 = life expectancy 𝑝𝑜𝑝𝑖 = population NOTE: The weighted average life expectancy is computed with the sum of the products of life expectancy by the total population of each country divided by the sum of the total population of each