From d8a85055f94d72b29c9374f4e541c9bfa7c197bb Mon Sep 17 00:00:00 2001 From: "512song@sina.com" Date: Mon, 14 Nov 2022 19:08:18 +0800 Subject: [PATCH 1/2] 20221114 --- 体测单位/巴陵石化.ipynb | 137 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 132 insertions(+), 5 deletions(-) diff --git a/体测单位/巴陵石化.ipynb b/体测单位/巴陵石化.ipynb index 20ceaf8..5c6f42d 100644 --- a/体测单位/巴陵石化.ipynb +++ b/体测单位/巴陵石化.ipynb @@ -57,12 +57,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "e5e4145b-d575-46b5-a530-c722668f76f3", "metadata": { + "execution": { + "iopub.execute_input": "2022-11-14T10:36:20.132710Z", + "iopub.status.busy": "2022-11-14T10:36:20.132189Z", + "iopub.status.idle": "2022-11-14T10:36:20.745694Z", + "shell.execute_reply": "2022-11-14T10:36:20.744512Z", + "shell.execute_reply.started": "2022-11-14T10:36:20.132662Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import json\n", "import time\n", @@ -107,6 +122,72 @@ "print('ok')" ] }, + { + "cell_type": "code", + "execution_count": 22, + "id": "df3ea897-92af-4f4f-9877-9a0b807cfc59", + "metadata": { + "execution": { + "iopub.execute_input": "2022-11-14T10:36:57.086011Z", + "iopub.status.busy": "2022-11-14T10:36:57.085472Z", + "iopub.status.idle": "2022-11-14T10:37:00.597648Z", + "shell.execute_reply": "2022-11-14T10:37:00.596497Z", + "shell.execute_reply.started": "2022-11-14T10:36:57.085962Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "title = ['编号','姓名','性别','部门','身高','','体重','','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n", + "filename = 'data/result_巴陵.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "filename = 'data/巴陵石化人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "\n", + "for k, v in dict2.items():\n", + " #print(k,dict2[str(k)]['name'])\n", + " list2 = []\n", + " list2.append(str(k).rjust(5,'0'))\n", + " list2.append(v['name']) \n", + " list2.append(dict1[k]['sex'])\n", + " list2.append(dict1[k]['unit']) \n", + " if len(v.keys())>5: \n", + " for item in items:\n", + " if item in v.keys():\n", + " list2.append(v[item]['成绩'])\n", + " list2.append(v[item]['得分']) \n", + " elif item =='name':\n", + " list2.append(v[item])\n", + " else:\n", + " list2.append('') \n", + " list2.append('') \n", + " list1.append(list2)\n", + "filename = 'data/巴陵石化体检报告人员体测情况表.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)\n", + "print('ok') " + ] + }, { "cell_type": "markdown", "id": "3c911994-2ce1-4412-8d56-39b195e66457", @@ -440,18 +521,64 @@ "print('ok!')" ] }, + { + "cell_type": "markdown", + "id": "fa9473fc-8e1c-4883-b919-6c5215f7b932", + "metadata": {}, + "source": [ + "### 统计有成绩无得分人员" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "9cfed761-0251-47b5-831b-e005b6675452", + "id": "cf17511f-9932-4191-9dae-d345e26ddf0d", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "title = ['编号','姓名','性别','部门','身高','','体重','','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n", + "filename = 'data/result_巴陵.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "filename = 'data/巴陵石化人员.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "\n", + "for k, v in dict2.items():\n", + " #print(k,dict2[str(k)]['name'])\n", + " list2 = []\n", + " list2.append(str(k).rjust(5,'0'))\n", + " list2.append(v['name']) \n", + " list2.append(dict1[k]['sex'])\n", + " list2.append(dict1[k]['unit']) \n", + " if len(v.keys())>5: \n", + " for item in items:\n", + " if item in v.keys() and v[item]['得分'] = '\\N':\n", + " \n", + " list2.append(v[item]['成绩'])\n", + " list2.append(v[item]['得分']) \n", + " \n", + " list1.append(list2)\n", + "filename = 'data/巴陵石化体检报告人员体测情况表.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)\n", + "print('ok') " + ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, From 7b945a2104b77e774ed99fc70d08d52addf5e0c6 Mon Sep 17 00:00:00 2001 From: "512song@sina.com" Date: Wed, 16 Nov 2022 17:45:53 +0800 Subject: [PATCH 2/2] 20221116 --- 体测单位/天津石化.ipynb | 126 +++++++++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 15 deletions(-) diff --git a/体测单位/天津石化.ipynb b/体测单位/天津石化.ipynb index 40abdf1..c17cfed 100644 --- a/体测单位/天津石化.ipynb +++ b/体测单位/天津石化.ipynb @@ -53,12 +53,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "a57ebb22-543c-4804-8d44-89984058ec1d", "metadata": { + "execution": { + "iopub.execute_input": "2022-11-16T09:35:45.541035Z", + "iopub.status.busy": "2022-11-16T09:35:45.540728Z", + "iopub.status.idle": "2022-11-16T09:35:45.957785Z", + "shell.execute_reply": "2022-11-16T09:35:45.957196Z", + "shell.execute_reply.started": "2022-11-16T09:35:45.541009Z" + }, "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], "source": [ "import json\n", "import time\n", @@ -113,9 +128,16 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "38397ad4-2bb3-4b5e-8ece-9ea11e801890", "metadata": { + "execution": { + "iopub.execute_input": "2022-11-16T09:41:28.683867Z", + "iopub.status.busy": "2022-11-16T09:41:28.683511Z", + "iopub.status.idle": "2022-11-16T09:41:29.562767Z", + "shell.execute_reply": "2022-11-16T09:41:29.562057Z", + "shell.execute_reply.started": "2022-11-16T09:41:28.683845Z" + }, "tags": [] }, "outputs": [], @@ -141,18 +163,18 @@ " list2.append(dict2[k]['sex'])\n", " list2.append(dict2[k]['unit'])\n", " list2.append(dict2[k]['sub_unit'])\n", - " \n", - " for item in items:\n", - " if item in v.keys():\n", - " list2.append(v[item]['成绩'])\n", - " \n", - " elif item =='name':\n", - " list2.append(v[item])\n", - " else:\n", - " list2.append('') \n", - " \n", - " list1.append(list2)\n", - "filename = 'data/天津石化体测情况表(截至20221110).xlsx'\n", + " if len(v.keys())>5:\n", + " for item in items:\n", + " if item in v.keys():\n", + " list2.append(v[item]['成绩'])\n", + "\n", + " elif item =='name':\n", + " list2.append(v[item])\n", + " else:\n", + " list2.append('') \n", + "\n", + " list1.append(list2)\n", + "filename = 'data/天津石化体测情况表(20221116).xlsx'\n", "wb = openpyxl.Workbook()\n", "sheet = wb.active\n", "sheet.append(title)\n", @@ -162,6 +184,80 @@ "wb.save(filename)" ] }, + { + "cell_type": "markdown", + "id": "07461b64-e57e-4b39-b010-b451c0da0e07", + "metadata": {}, + "source": [ + "## 导出测试成绩(带得分)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "0c95d716-11ab-4f6e-ab43-b72394946ded", + "metadata": { + "execution": { + "iopub.execute_input": "2022-11-16T09:36:27.473683Z", + "iopub.status.busy": "2022-11-16T09:36:27.473373Z", + "iopub.status.idle": "2022-11-16T09:36:28.925329Z", + "shell.execute_reply": "2022-11-16T09:36:28.924695Z", + "shell.execute_reply.started": "2022-11-16T09:36:27.473656Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import json\n", + "import openpyxl\n", + "\n", + "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "title = ['编号','姓名','性别','单位/部门','车间/科室','身高','','体重','','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n", + "filename = 'data/result_天津.json'\n", + "with open(filename,'r') as fl:\n", + " dict2 = json.load(fl)\n", + "filename = 'data/天津石化人员名单.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl)\n", + "list1 = []\n", + "\n", + "for k, v in dict2.items():\n", + " #print(k,dict2[str(k)]['name'])\n", + " list2 = []\n", + " list2.append(str(k).rjust(5,'0'))\n", + " list2.append(v['name']) \n", + " list2.append(dict1[k]['sex'])\n", + " list2.append(dict1[k]['unit']) \n", + " list2.append(dict2[k]['sub_unit'])\n", + " if len(v.keys())>5: \n", + " for item in items:\n", + " if item in v.keys():\n", + " list2.append(v[item]['成绩'])\n", + " list2.append(v[item]['得分']) \n", + " elif item =='name':\n", + " list2.append(v[item])\n", + " else:\n", + " list2.append('') \n", + " list2.append('') \n", + " list1.append(list2)\n", + "filename = 'data/天津石化人员体测情况表.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)\n", + "print('ok') " + ] + }, { "cell_type": "markdown", "id": "1c7b219f-43cd-4bf0-971f-2c398f8db8ed",