This commit is contained in:
512song committed 2023-09-22 12:06:37 +08:00
1 parent 6ace8392ab
commit 6ffa466fd9
1 file changed
+57 -1
+57 -1
View File
@@ -1799,10 +1799,66 @@
"wb.save(filename)"
]
},
{
"cell_type": "markdown",
"id": "d8e4038d-8ba0-48e7-b101-d30539cc2c2a",
"metadata": {},
"source": [
"## 统计单一部门未体测人员明细表"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "2f7c9847-f283-4a09-b385-2c7559be7c7e",
"metadata": {
"execution": {
"iopub.execute_input": "2023-09-22T03:11:56.942175Z",
"iopub.status.busy": "2023-09-22T03:11:56.941710Z",
"iopub.status.idle": "2023-09-22T03:11:57.030749Z",
"shell.execute_reply": "2023-09-22T03:11:57.030121Z",
"shell.execute_reply.started": "2023-09-22T03:11:56.942138Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"filename = 'data/result_天津2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/天津石化人员名单2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"unit_name = '炼油部'\n",
"rq = '20230922'\n",
"list1 = []\n",
"\n",
"i = 1\n",
"for k, v in dict2.items():\n",
" unit = v['unit']\n",
" if unit == unit_name and k not in dict1.keys():\n",
" list2 = [i,k,v['name'],unit,v['sub_unit']]\n",
" i+=1\n",
" list1.append(list2)\n",
"filename = f'data/天津石化{unit_name}未测试人员名单(截至{rq}).xlsx'\n",
"title = ['序号','员工编号','姓名','部门','车间(科室)']\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
"for row in list1:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "52680817-304b-44e6-b7d5-74c6f12bbb94",
"id": "f4bfc9f6-9d90-4ab1-8682-c012962389f0",
"metadata": {},
"outputs": [],
"source": []