From 11eb67a1d8cc52a53e30c981fa331579ae89bc79 Mon Sep 17 00:00:00 2001 From: mxr612 Date: Sat, 14 Jun 2025 04:22:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=91=98=E5=B7=A5?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95=E4=B8=AD=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E8=AF=81=E5=92=8C=E5=A7=93=E5=90=8D=E7=9A=84=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将身份证号码和姓名的赋值操作移到循环内部,确保每条历史记录都包含正确的个人信息 --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index a172d43..36a8624 100644 --- a/main.py +++ b/main.py @@ -380,6 +380,8 @@ def main(): for rule in Rule_Level: if row["入职时间"] < rule["start"]: History_pd.loc[len(History_pd),["变动后时间","变动原因"]] = [rule["start"], "工资调标"] + History_pd["身份证号码"] = row["身份证号码"] + History_pd["姓名"] = row["姓名"] History_pd["工龄"] = History_pd.apply(lambda x: calculate_seniority(row, x["变动后时间"]), axis=1) History_pd = History_pd.sort_values(by="时间").reset_index(drop=True) @@ -444,8 +446,6 @@ def main(): fill_history_info(ws, History_pd)# 填充历史记录 # 将当前人员的历史记录添加到总表中 - History_pd["身份证号码"] = row["身份证号码"] - History_pd["姓名"] = row["姓名"] all_history = pd.concat([all_history, History_pd], ignore_index=True) wb.save(f"个人台账/{row['身份证号码']}_{row['姓名']}.xlsx")