From d8a85055f94d72b29c9374f4e541c9bfa7c197bb Mon Sep 17 00:00:00 2001 From: "512song@sina.com" Date: Mon, 14 Nov 2022 19:08:18 +0800 Subject: [PATCH] 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" },