Home Forums Data Science with Python Data Analytics : Computing Total / Sum of a Field in a Data Set Reply To: Data Analytics : Computing Total / Sum of a Field in a Data Set

#1785

Solution:

To solve the above problem we will create a dictionary in which the key would be year and the subsequent value would be a list containing the value of sales for that year.
After that we can simply sum the list in the value part of the dictionary.
Below is the python code to get the desired outcome:

Python code