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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1776

    Below is the data stored in comma separated format csv file:

    Write a python program which can give the total sales in the year 2017 and 2018

    #1783

    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 solution data analysis

    #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

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.