# Q3: How many part-time employees are there? import helper data = helper.read_salaries() employee_type = helper.get_column(data, 4) # get employee type (full or part-time) print(helper.count(employee_type, 'P')) # print full-time count
# Q5: How many detectives? import helper data = helper.read_salaries() jobs = helper.get_column(data, 2) print(helper.count(jobs, 'DETECTIVE'))
# Q6: How big is the largest department? Which one is it? import helper data = helper.read_salaries() departments = helper.get_column(data, 3) # get department column counts = helper.counts(departments) # count departments print(helper.dict_max_value(counts)) # print maximum
# Q3: How many part-time employees are there? import helper data = helper.read_salaries() timing = helper.get_column(data, 4) print(helper.count(timing, 'P'))
# Q2: How many full time employees are there? import helper data = helper.read_salaries() job_term = helper.get_column(data, 4) full_time_employees = helper.count(job_term, "F") print(full_time_employees) #31,090 full_time_employees
# Q3: How many part-time employees are there? import helper #import module data = helper.read_salaries() part_time = helper.get_column(data, 4) #assign variable name to look in position type count_parttime = helper.count(part_time, 'P') #count the specific type of part-time employees print(count_parttime)
# Q7: How common is the most common last name? Which is it? import helper data = helper.read_salaries() names = helper.get_column(data, 1) # get first names counts = helper.counts(names) # count them print(helper.dict_max_value(counts)) # print maximum last_names = helper.get_column(data, 0) #get last names counts_last = helper.counts(last_names) #count last names print(helper.dict_max_value(counts_last)) #print maximum
# Q7: How common is the most common first name? Which is it? import helper data = helper.read_salaries() names = helper.get_column(data, 1) # get first names counts = helper.counts(names) # count them print(helper.dict_max_value(counts)) # print maximum
# Q5: How many detectives? import helper data = helper.read_salaries() detective_only = helper.get_column(data, 2) detective_count = helper.count(detective_only, "POLICE OFFICER (ASSIGNED AS DETECTIVE)") print(detective_count) #989 detectives
# Q5: How many detectives? import helper data = helper.read_salaries() positions = helper.get_column(data, 2) # get positions print(helper.count( positions, 'POLICE OFFICER (ASSIGNED AS DETECTIVE)')) # print police detective count
# Q5: How many detectives? import helper data = helper.read_salaries() detectives_list = helper.get_column(data, 2) # #assign variable name to look in Job Title column detectives_count = helper.count(detectives_list, "POLICE OFFICER (ASSIGNED AS DETECTIVE)") #count the number of detectives print(detectives_count)
# Q4: How many employees in the police department? import helper data = helper.read_salaries() department = helper.get_column(data, 3) print(helper.count(department, 'POLICE'))
# Q8: What are the minimum, mean, median, and maximum salaries? import helper data = helper.read_salaries() rawsalaries = helper.get_column(data,-2) salaries = [] for entry in rawsalaries: if len(entry) > 0: salaries.append(float(entry)) print('Minimum:', min(salaries)) print('Mean:', helper.mean(salaries)) print('Median:', helper.median(salaries)) print('Maximum:', max(salaries))
# Q4: How many employees in the police department? import helper data = helper.read_salaries() police_only = helper.get_column(data, 3) police_count = helper.count(police_only, "POLICE") print(police_count) #13,414 employees in the police department