From f32d8ba3f3df53666dcd654aa7e954b8f9b7634c Mon Sep 17 00:00:00 2001 From: 512song Date: Tue, 19 Sep 2023 03:22:28 +0000 Subject: [PATCH] 20230919 --- 体测单位/天津石化.ipynb | 100 +++++++++++++--------------------------- 1 file changed, 31 insertions(+), 69 deletions(-) diff --git a/体测单位/天津石化.ipynb b/体测单位/天津石化.ipynb index 1c01ac1..37acc58 100644 --- a/体测单位/天津石化.ipynb +++ b/体测单位/天津石化.ipynb @@ -4,6 +4,7 @@ "cell_type": "markdown", "id": "e764be85-0ddf-4055-abd6-de2990e75db8", "metadata": { + "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -1504,27 +1505,12 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "25283932-c03a-4a34-a59d-314fc64d8fbd", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-18T11:07:39.418682Z", - "iopub.status.busy": "2023-09-18T11:07:39.418211Z", - "iopub.status.idle": "2023-09-18T11:07:40.143672Z", - "shell.execute_reply": "2023-09-18T11:07:40.143214Z", - "shell.execute_reply.started": "2023-09-18T11:07:39.418645Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "ok\n" - ] - } - ], + "outputs": [], "source": [ "import openpyxl\n", "import json\n", @@ -1599,28 +1585,12 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "e26b88fc-c75b-4c1e-82ea-5017370afa9b", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-18T11:26:25.004900Z", - "iopub.status.busy": "2023-09-18T11:26:25.004403Z", - "iopub.status.idle": "2023-09-18T11:26:25.065113Z", - "shell.execute_reply": "2023-09-18T11:26:25.064139Z", - "shell.execute_reply.started": "2023-09-18T11:26:25.004862Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "184\n", - "184\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "import time\n", @@ -1656,6 +1626,7 @@ " re_ta[user]['name'] = dict1[user]['name']\n", " re_ta[user]['sex'] = dict1[user]['sex'] \n", " re_ta[user]['unit'] = dict1[user]['unit']\n", + " re_ta[user]['sub_unit'] = dict1[user]['sub_unit']\n", " item_name = item[m_item]['name']\n", " re_ta[user].setdefault(item_name,{}) \n", " score = int(result[4])/item[m_item]['divisor'] \n", @@ -1678,16 +1649,9 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "0a6ea33d-c112-4ed8-9366-3376e55a5731", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-18T11:19:24.311567Z", - "iopub.status.busy": "2023-09-18T11:19:24.311099Z", - "iopub.status.idle": "2023-09-18T11:19:24.414514Z", - "shell.execute_reply": "2023-09-18T11:19:24.414032Z", - "shell.execute_reply.started": "2023-09-18T11:19:24.311530Z" - }, "tags": [] }, "outputs": [], @@ -1696,7 +1660,7 @@ "import openpyxl\n", "\n", "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", - "title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", + "title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "\n", "filename = 'data/result_天津2023.json'\n", "with open(filename,'r') as fl:\n", @@ -1713,6 +1677,7 @@ " list2.append(v['name']) \n", " list2.append(dict2[k]['sex'])\n", " list2.append(dict2[k]['unit'])\n", + " list2.append(dict2[k]['sub_unit'])\n", " for item in items:\n", " if item in v.keys():\n", " list2.append(v[item]['成绩']) \n", @@ -1741,27 +1706,12 @@ }, { "cell_type": "code", - "execution_count": 17, - "id": "3f47ee9d-e520-4141-9e44-084f61d19590", + "execution_count": null, + "id": "589a5d44-605d-41a1-a981-7ec7258305ed", "metadata": { - "execution": { - "iopub.execute_input": "2023-09-18T11:35:14.320583Z", - "iopub.status.busy": "2023-09-18T11:35:14.320133Z", - "iopub.status.idle": "2023-09-18T11:35:14.372395Z", - "shell.execute_reply": "2023-09-18T11:35:14.371056Z", - "shell.execute_reply.started": "2023-09-18T11:35:14.320547Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'消防支队': 92, '电仪部': 350, '水务部': 441, '烯烃部': 359, '热电部': 498, '炼油部': 1271, '化工部': 608, '运输销售部': 225, '化验计量部': 503, '南港烯烃部': 779, '公司机关': 402, '信息档案管理中心': 70, '装备研究院': 57, '原油储运部': 203, '党委党校(培训中心)': 79, '研究院': 110, '南港乙烯项目管理部': 70, '行政事务中心': 133, '聚醚部': 153, '物资采购中心': 198}\n" - ] - } - ], + "outputs": [], "source": [ "import json\n", "\n", @@ -1776,18 +1726,30 @@ "dict3 = {}\n", "for k, v in dict2.items():\n", " unit = v['unit']\n", - " dict3.setdefault(unit,0)\n", - " dict3[unit] = dict3[unit] + 1\n", - "print(dict3)\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", - " dict3[unit] = dict3[unit] - 1\n", + " sub_unit = v['sub_unit']\n", + " dict3[unit]['sub_unit'] = dict3[unit][sub_unit] - 1\n", + "\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", " \n", "for k, v in dict3.items():\n", - " list2 = [k,v]\n", - " list1.append(list2)\n", + " for k1, v1 in v.items():\n", + " list2 = [k,k1,v1]\n", + " list1.append(list2)\n", "\n", "filename = 'data/天津部门未测试情况(截至20230918).xlsx'\n", "wb = openpyxl.Workbook()\n", @@ -1802,7 +1764,7 @@ { "cell_type": "code", "execution_count": null, - "id": "589a5d44-605d-41a1-a981-7ec7258305ed", + "id": "1b1c5356-0f90-4124-ba73-2e60b74c55df", "metadata": {}, "outputs": [], "source": []