Example #1
0
    def bin_salary_data(self, data, **kwargs):
        float_data = np.asarray(data, dtype='float')
        max_value = np.amax(float_data)

        bin_size = DISTRIBUTION_MAX / DISTRIBUTION_BIN_NUM

        bin_edges = np.array(
            [i * bin_size for i in range(DISTRIBUTION_BIN_NUM + 1)],
            dtype='float'
        )

        if max_value > bin_edges[-1]:
            bin_edges = np.append(bin_edges, max_value)

        values, edges = np.histogram(float_data, bins=bin_edges)

        salary_json = []

        for i, value in enumerate(values):
            lower, upper = int(edges[i]), int(edges[i + 1])

            salary_json.append({
                'value': int(value),  # number of salaries in given bin
                'lower_edge': format_ballpark_number(lower),
                'upper_edge': format_ballpark_number(upper),
                'color': self._get_bar_color(lower, upper, **kwargs),
            })

        return salary_json
Example #2
0
    def get_department_salaries(self, obj):
        formatted_salaries = []

        for salary in self.department_statistics[:5]:
            formatted_salaries.append({
                'name':
                salary.name,
                'slug':
                salary.slug,
                'headcount':
                format_exact_number(salary.headcount),
                'median_tp':
                format_salary(salary.median_tp),
                'entity_bp':
                format_ballpark_number(salary.entity_bp),
                'entity_ep':
                format_ballpark_number(salary.entity_ep),
                'total_expenditure':
                format_ballpark_number(salary.total_expenditure),
            })

        return formatted_salaries
Example #3
0
 def get_total_expenditure(self, obj):
     return format_ballpark_number(self.employer_payroll['base_pay'] +
                                   self.employer_payroll['extra_pay'])
Example #4
0
 def get_headcount(self, obj):
     return format_ballpark_number(self.employer_salary_count)