help me to do the function of Calculate total sales for each employee,and mean sales for each employee,image 2 is data from csv file

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

help me to do the function of Calculate total sales for each employee,and mean sales for each employee,image 2 is data from csv file

Name
Jim
Jan
Feb
Mar
Apr
Мay
Jun
Jul
Aug
Sep
Oct
Nov
Dec
5496. 04 7037. 32 8418. 62 2007. 48 4774. 86 2601. 29 5636. 29
5220. 1 6739.75 4712. 52
5932. 6
4890. 14
Sarah
5455. 32
5014. 6 11752.09 5984. 77 6648. 16
4352. 4 8764. 03
9805. 85 3174. 66 7424. 05 2420. 75
4680. 42
Fred
7816. 79 6221. 95 11878. 92 7310. 63
4457. 65 3289.59 8109. 96
5015. 6
5954. 15
4767. 49
4394. 66 5735. 65
Mike
4773. 88 5306. 81 7210. 58 5650. 88 7606. 02 5233. 32 3927. 58 9747. 82 5281. 56 3875. 81 7929. 94 3497. 57
Debra
5684. 8 8276. 58 5300. 27 3162. 67
4643. 16 3298. 18 4380. 02 7622. 52 7505. 82 4318. 47 5298. 99 5378. 61
Transcribed Image Text:Name Jim Jan Feb Mar Apr Мay Jun Jul Aug Sep Oct Nov Dec 5496. 04 7037. 32 8418. 62 2007. 48 4774. 86 2601. 29 5636. 29 5220. 1 6739.75 4712. 52 5932. 6 4890. 14 Sarah 5455. 32 5014. 6 11752.09 5984. 77 6648. 16 4352. 4 8764. 03 9805. 85 3174. 66 7424. 05 2420. 75 4680. 42 Fred 7816. 79 6221. 95 11878. 92 7310. 63 4457. 65 3289.59 8109. 96 5015. 6 5954. 15 4767. 49 4394. 66 5735. 65 Mike 4773. 88 5306. 81 7210. 58 5650. 88 7606. 02 5233. 32 3927. 58 9747. 82 5281. 56 3875. 81 7929. 94 3497. 57 Debra 5684. 8 8276. 58 5300. 27 3162. 67 4643. 16 3298. 18 4380. 02 7622. 52 7505. 82 4318. 47 5298. 99 5378. 61
print("Used Car Sales")
print("\n1. Import sales data from csv") # import sales data
print("2. Calculate total sales for each employee") # calculate total sales of employees
print("3. Calculate mean sales for each employee") # calculate the monthly mean sales for each employee
print("4. Graph of monthly sales data") # Create graph of monthly sales data
print("5. Exit") # Exit program
option = -1 # used to store the user's choice
# while x is less than 1 or greater than 5, loop
# used to validate user input
while option < 1 or option > 5:
# get user's choice
option = int(input("\nwhich operation do yoU want to perform?\n"))
return option
# function which will open the csv file and read in its values and return a list containing each record as a dictionary
adef open_csv_file(file_path):
database = [] # create empty list
with open(file_path,"r") as csv_file: # open file in read mode
# use DictReader to read in the data
# add each line, as a dictionary, to the list 'database'
# return the database
return database
# finds and returns a list of the total sales for each employee
def calc_total_sales(database):
# create empty list
total_sales = []
# iterate through each record
# initialise a variable to track the total
# loop through each key (need to ignore name key) and add to total
# append total value to total_sales list
# return list of total sales for each employee
return total_sales
def calc_mean_sales(sales_list):
pass # DELETE THIS AND ADD YOUR CODE HERE
Transcribed Image Text:print("Used Car Sales") print("\n1. Import sales data from csv") # import sales data print("2. Calculate total sales for each employee") # calculate total sales of employees print("3. Calculate mean sales for each employee") # calculate the monthly mean sales for each employee print("4. Graph of monthly sales data") # Create graph of monthly sales data print("5. Exit") # Exit program option = -1 # used to store the user's choice # while x is less than 1 or greater than 5, loop # used to validate user input while option < 1 or option > 5: # get user's choice option = int(input("\nwhich operation do yoU want to perform?\n")) return option # function which will open the csv file and read in its values and return a list containing each record as a dictionary adef open_csv_file(file_path): database = [] # create empty list with open(file_path,"r") as csv_file: # open file in read mode # use DictReader to read in the data # add each line, as a dictionary, to the list 'database' # return the database return database # finds and returns a list of the total sales for each employee def calc_total_sales(database): # create empty list total_sales = [] # iterate through each record # initialise a variable to track the total # loop through each key (need to ignore name key) and add to total # append total value to total_sales list # return list of total sales for each employee return total_sales def calc_mean_sales(sales_list): pass # DELETE THIS AND ADD YOUR CODE HERE
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education