functions.py 文件源码

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

项目:seniority_list 作者: rubydatasystems 项目源码 文件源码
def anon_pay_table(case,
                   proportional=True,
                   mult=1.0,):
    '''Anonymize the "rates" worksheet of the "pay_tables.xlsx" input file.
    The rates may be proportionally adjusted (larger or smaller) or
    disproportionally adjusted with a fixed algorithm.
    A copy of the original excel file is copied and saved as
    "pay_tables_orig.xlsx".
    All modifications are inplace.
    inputs
        case (string)
            the case name
        proportional (boolean)
            if True, use the mult input to increase or decrease all of the
            "rates" worksheet pay data proportionally.  If False, use a fixed
            algorithm to disproportionally adjust the pay rates.
        mult (integer or float)
            if the proportional input is True, multiply all pay rate values
            by this input value
    '''
    inplace = True

    path, d = copy_excel_file(case, 'pay_tables', return_path_and_df=True)
    df = d['rates']
    anon_pay(df,
             proportional=proportional,
             mult=mult,
             inplace=inplace)
    d['rates'] = df

    with pd.ExcelWriter(path, engine='xlsxwriter') as writer:

        for ws_name, df_sheet in d.items():
            df_sheet.to_excel(writer, sheet_name=ws_name)

    print('\nanon_pay_table routine complete')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号