functions.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:seniority_list 作者: rubydatasystems 项目源码 文件源码
def mark_for_furlough(orig_range,
                      fur_range,
                      month,
                      jobs_avail,
                      num_of_job_levels):
    '''Assign fur code to employees when count of jobs is
    less than count of active employees in inverse seniority
    order and assign furloughed job level number.
    note: normally only called during a job change month though it
    will do no harm if called in other months
    inputs
        orig_range
            current month slice of jobs held
        fur_range
            current month slice of fur data
        month
            current month (loop) number
        jobs_avail
            total number of jobs for each month
            array, job_gain_loss_table function output [1]
        num_of_job_levels
            from settings dictionary, used to mark fur job level as
            num_of_job_levels + 1
    '''
    active_count = np.count_nonzero(fur_range == 0)

    excess_job_slots = jobs_avail[month] - active_count

    if excess_job_slots >= 0:
        return

    elif excess_job_slots < 0:

        non_fur_indexes = np.where(fur_range == 0)[0]

        np.put(fur_range,
               non_fur_indexes[excess_job_slots:],
               1)
        np.put(orig_range,
               non_fur_indexes[excess_job_slots:],
               num_of_job_levels + 1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号