[Build 1.3.0] feat: 添加后备学历处理逻辑

- 新增一个后备函数用于处理学历字段,确保在缺失值情况下返回有效的学历信息
- 修改Excel输出逻辑,优先使用现学历字段,提升数据的完整性和准确性
This commit is contained in:
Miu Li 2025-06-04 16:13:09 +08:00
parent 9c6ded38c5
commit af32927f5b

View File

@ -149,6 +149,12 @@ BaseData["工龄调增"] = BaseData["工龄调增"].apply(to_int)
BaseData["工龄调减"] = BaseData["工龄调减"].apply(to_int)
BaseData["学龄"] = BaseData["学龄"].apply(to_int)
def fallback(x):
for i in x:
if pd.notna(i) and i != '':
return i
return ''
max_promote = 0
max_history = 0
@ -332,7 +338,7 @@ for index, row in BaseData.iterrows(): # 汇总
ws.cell(row=6+index, column=3, value=row["性别"])
ws.cell(row=6+index, column=4, value=format_time(row["出生年月"], "出生年月"))
ws.cell(row=6+index, column=5, value=format_time(row["参加工作时间"], "参加工作时间"))
ws.cell(row=6+index, column=6, value=row["学历"])
ws.cell(row=6+index, column=6, value=fallback([row["现学历"],row["学历"]]))
ws.cell(row=6+index, column=7, value=nowtime.year-row["参加工作时间"].year+row["工龄调增"]-row["工龄调减"]+1+row["学龄"])
ws.cell(row=6+index, column=8, value=nowtime.year-row["参加工作时间"].year+row["工龄调增"]-row["工龄调减"]+1)
ws.cell(row=6+index, column=9, value=row["学龄"])