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')
评论列表
文章目录