20251107
This commit is contained in:
1 parent
2e77e939dd
commit
b2ba8722fa
5 files changed
+855
-182
No files matched your search
+178
-1
@@ -3205,10 +3205,187 @@
|
||||
"print(len(list1),'ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6139bf27-5367-451f-9f1a-f252625eab1d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 合并读卡系统文件"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"id": "2d7f5a24-f247-4199-a84d-dcf611dbeef6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-06T09:49:25.694191Z",
|
||||
"iopub.status.busy": "2025-11-06T09:49:25.693476Z",
|
||||
"iopub.status.idle": "2025-11-06T09:49:25.720613Z",
|
||||
"shell.execute_reply": "2025-11-06T09:49:25.719806Z",
|
||||
"shell.execute_reply.started": "2025-11-06T09:49:25.694101Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"864 杨小波 \n",
|
||||
"865 宋舒波 炼油一部\n",
|
||||
"866 黄耀 公用工程部\n",
|
||||
"867 陈永佳 炼油一部\n",
|
||||
"868 欧阳惠婕 检验计量中心\n",
|
||||
"868 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/data_北海2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" list1 = json.load(fl)\n",
|
||||
"for item in list1:\n",
|
||||
" code = item['id'].lower()\n",
|
||||
" if code not in dict1.keys():\n",
|
||||
" print(code,item['name'],item['unit'])\n",
|
||||
" code = code.lower()\n",
|
||||
" dict1.setdefault(code,{})\n",
|
||||
" dict1[code]['name'] = item['name']\n",
|
||||
" dict1[code]['sex'] = item['gender']\n",
|
||||
" dict1[code]['unit'] = item['unit']\n",
|
||||
" dict1[code]['birth'] = item['birth']\n",
|
||||
"filename = 'data/北海炼化人员2025.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print(len(dict1),'ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "cccfebad-8fc5-4aa9-b15d-05eff2fa421f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 获取人员测试成绩"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"id": "7b79c7bb-ce87-44b2-95b1-01e9cb66d5f0",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-06T09:50:07.068317Z",
|
||||
"iopub.status.busy": "2025-11-06T09:50:07.067538Z",
|
||||
"iopub.status.idle": "2025-11-06T09:50:07.100869Z",
|
||||
"shell.execute_reply": "2025-11-06T09:50:07.100391Z",
|
||||
"shell.execute_reply.started": "2025-11-06T09:50:07.068246Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"333\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
"import csv\n",
|
||||
"from datetime import date\n",
|
||||
"import my_module as My\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/marks_20251106.csv'\n",
|
||||
"re_ta = My.get_result(filename,dict1)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海2025.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
||||
"print(len(re_ta))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "12b33ee8-2b4e-4b85-9301-4fbcadf4129c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 统计各部门测试情况"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"id": "ca079428-2df9-4f15-b141-2c83cd0efaf5",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-06T09:50:13.734766Z",
|
||||
"iopub.status.busy": "2025-11-06T09:50:13.734508Z",
|
||||
"iopub.status.idle": "2025-11-06T09:50:13.753135Z",
|
||||
"shell.execute_reply": "2025-11-06T09:50:13.752583Z",
|
||||
"shell.execute_reply.started": "2025-11-06T09:50:13.734739Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
"\n",
|
||||
"dict3 = {}\n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" unit = v['unit']\n",
|
||||
" #sub_unit = v['sub_unit']\n",
|
||||
" dict3.setdefault(unit,{})\n",
|
||||
" dict3[unit].setdefault('人数',0)\n",
|
||||
" dict3[unit].setdefault('体测人数',0)\n",
|
||||
" #dict3[unit].setdefault(sub_unit,0)\n",
|
||||
" #dict3[unit][sub_unit] = dict3[unit][sub_unit] + 1\n",
|
||||
" dict3[unit]['人数'] = dict3[unit]['人数'] + 1\n",
|
||||
"\n",
|
||||
"title =['单位','报名人数','体测人数']\n",
|
||||
"list1 = []\n",
|
||||
"for k,v in dict1.items(): \n",
|
||||
" unit = v['unit']\n",
|
||||
" #sub_unit = v['sub_unit']\n",
|
||||
" #dict3[unit][sub_unit] = dict3[unit][sub_unit] - 1\n",
|
||||
" dict3[unit].setdefault('体测人数',0)\n",
|
||||
" dict3[unit]['体测人数'] = dict3[unit]['体测人数'] + 1\n",
|
||||
"for k, v in dict3.items():\n",
|
||||
" list2 = [k,v['人数'],v['体测人数']]\n",
|
||||
" list1.append(list2)\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化部门测试情况(截至20251105).xlsx'\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": "8ac3a30f-002f-49b4-bbb0-c63ac37037f9",
|
||||
"id": "78f2737d-97e7-4ded-994a-86818119597a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user