Exemple #1
0
# 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
Exemple #2
0
# Q5: How many detectives?
import helper

data = helper.read_salaries()
jobs = helper.get_column(data, 2)
print(helper.count(jobs, 'DETECTIVE'))
Exemple #3
0
# 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
Exemple #4
0
# 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'))
Exemple #5
0
# 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
Exemple #6
0
# 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)
Exemple #7
0
# 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
Exemple #8
0
# 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
Exemple #9
0
# 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
Exemple #10
0
# 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
Exemple #11
0
# 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)
Exemple #12
0
# 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'))
Exemple #13
0
# 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))
Exemple #14
0
# 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