From 30867f302c83e77497eb5fa6ed1259b5301271a7 Mon Sep 17 00:00:00 2001 From: mxr612 Date: Sat, 14 Jun 2025 06:05:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=94=E5=B9=B41?= =?UTF-8?q?=E7=BA=A7=E5=92=8C=E4=B8=A4=E5=B9=B41=E6=A1=A3=E5=B9=B4?= =?UTF-8?q?=E4=BB=BD=E8=AE=A1=E7=AE=97=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在历史记录中新增五年1级年份和两年1档年份的计算逻辑 - 更新变动前时间字段的格式化处理,确保数据一致性 --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index f7e19cd..d0d4e38 100644 --- a/main.py +++ b/main.py @@ -392,6 +392,8 @@ def main(): History_pd["身份证号码"] = row["身份证号码"] History_pd["姓名"] = row["姓名"] History_pd["工龄"] = History_pd.apply(lambda x: calculate_seniority(row, x["变动后时间"].year), axis=1) + History_pd["五年1级年份"] = History_pd.apply(lambda x: x["变动后时间"].year - row["晋级起始"].year, axis=1) + History_pd["两年1档年份"] = History_pd.apply(lambda x: x["变动后时间"].year - row["晋档起始"].year, axis=1) History_pd = History_pd.sort_values(by="变动后时间").reset_index(drop=True) if History_pd.at[0,"变动后时间"] != row["入职时间"]: @@ -469,6 +471,7 @@ def main(): # 保存所有历史记录到Excel文件 all_history["变动后时间"] = all_history["变动后时间"].apply(lambda x: format_time_ymd(x, "历史记录时间")) + all_history["变动前时间"] = all_history["变动前时间"].apply(lambda x: format_time_ymd(x, "历史记录时间")) all_history.to_excel("所有人员历史记录.xlsx", index=False) logging.info("所有人员历史记录已保存到'所有人员历史记录.xlsx'")