20241201
This commit is contained in:
1 parent
752e3f388e
commit
f763498a42
1 file changed
+127
-31
+127
-31
@@ -636,7 +636,6 @@
|
||||
"cell_type": "markdown",
|
||||
"id": "c103301b-d540-4bf5-861a-0eb2e313e26e",
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true,
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
@@ -2122,15 +2121,18 @@
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(3, sheet.max_row+1):\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 2).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['unit'] = sheet.cell(n, 6).value\n",
|
||||
" dict1['phone'] = sheet.cell(n, 5).value\n",
|
||||
" dict1['birth'] = sheet.cell(n,4).value\n",
|
||||
" person[code] = dict1\n",
|
||||
" if sheet.cell(n, 1).value is not None:\n",
|
||||
" #print(sheet.cell(n, 1).value)\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 2).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['unit'] = sheet.cell(n, 6).value\n",
|
||||
" dict1['phone'] = sheet.cell(n, 5).value\n",
|
||||
" dict1['birth'] = sheet.cell(n,4).value\n",
|
||||
" person[code] = dict1\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员2024.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
@@ -2197,7 +2199,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/marks_20241124.csv'\n",
|
||||
"filename = 'data/marks_20241201.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -2256,7 +2258,7 @@
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','banlance','reaction','step']\n",
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海炼化2024.json'\n",
|
||||
@@ -2311,26 +2313,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": null,
|
||||
"id": "dd89efe8-13b9-4db8-8c39-2a48888dd635",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-11-26T01:21:08.964696Z",
|
||||
"iopub.status.busy": "2024-11-26T01:21:08.963964Z",
|
||||
"iopub.status.idle": "2024-11-26T01:21:09.431950Z",
|
||||
"shell.execute_reply": "2024-11-26T01:21:09.431433Z",
|
||||
"shell.execute_reply.started": "2024-11-26T01:21:08.964630Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
@@ -2435,6 +2421,116 @@
|
||||
"wb.save(filename)\n",
|
||||
"print('ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b46477dd-f9d0-40b8-ae25-62f3ffb5dc1e",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 统计各部门测试情况"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c4095c79-aeb7-40a7-a3a4-026fb7be8180",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海炼化2024.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员2024.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(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/北海炼化部门测试情况2024.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": "markdown",
|
||||
"id": "f65ac3f5-07fd-4191-a9ce-f71312aec993",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 统计各部门未参加人员信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "974edd35-7203-4387-8673-ffba537ee160",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海炼化2024.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员2024.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"\n",
|
||||
"i = 1\n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" \n",
|
||||
" if k not in dict1.keys():\n",
|
||||
" list2 = [i,k,v['name'],v['unit']]\n",
|
||||
" i+=1\n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = f'data/北海炼化未测试人员名单.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",
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a2cce583-323d-4631-a9bd-39052d3cccbf",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in new issue
Block a user