I just started to learn pandas in Python so please excuse me if it's a very basic level of question but I am unable to find its solution on the internet or in docs [maybe I don't know which function to see in documentation].
I have a data set where the rural and urban population is mentioned categorized by year
Rural population,1990,74
Urban population,1990,32
Urban population,1991,34
Rural population,1991,76
Rural population,1992,78
Urban population,1992,35
Urban population,1993,36
Rural population,1993,80
Rural population,1994,81
Urban population,1994,37
...
I want to add new data based on the sum of all the years' data.
For example,
in first 2 rows; in 1990 Rural population is 74 and Urban population is 32
I want to add a new row at the end of each year which contains the sum value of 74 + 32 so data looks like this
Rural population,1990,74
Urban population,1990,32
Total population,1990,106
Urban population,1991,34
Rural population,1991,76
Total population,1991,110
...
How can I do this?