From d0e10e6e80243db7914369c048f60c52e5024962 Mon Sep 17 00:00:00 2001 From: 512song Date: Fri, 21 Apr 2023 07:25:47 +0000 Subject: [PATCH] 20230421 --- 体测单位/淄博高新区.ipynb | 292 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 292 insertions(+) create mode 100644 体测单位/淄博高新区.ipynb diff --git a/体测单位/淄博高新区.ipynb b/体测单位/淄博高新区.ipynb new file mode 100644 index 0000000..e7aea6b --- /dev/null +++ b/体测单位/淄博高新区.ipynb @@ -0,0 +1,292 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "9caef37c-26bd-4590-abe6-4c0255c2886f", + "metadata": {}, + "source": [ + "## 人员基本信息导入" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "6ab7bf77-5451-4773-9b13-10e04a48ddfb", + "metadata": { + "execution": { + "iopub.execute_input": "2023-04-21T06:44:50.778622Z", + "iopub.status.busy": "2023-04-21T06:44:50.777794Z", + "iopub.status.idle": "2023-04-21T06:44:51.048732Z", + "shell.execute_reply": "2023-04-21T06:44:51.047657Z", + "shell.execute_reply.started": "2023-04-21T06:44:50.778580Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "wb = openpyxl.load_workbook('data/高新区名单.xlsx')\n", + "sheet = wb.active\n", + "# sheets = wb.sheetnames\n", + "person = {}\n", + "for n in range(2, sheet.max_row+1):\n", + " if sheet.cell(n,2).value is None:\n", + " break\n", + " else: \n", + " code = int(sheet.cell(n, 1).value)\n", + " person.setdefault(code, {})\n", + " dict1 = {}\n", + " dict1['name'] = sheet.cell(n, 2).value \n", + " sex = str(sheet.cell(n, 3).value)\n", + " dict1['sex'] = sex\n", + " dict1['birth'] = str(sheet.cell(n,8).value).split(' ')[0]\n", + " if sheet.cell(n,5).value is not None:\n", + " dict1['phone'] = sheet.cell(n,5).value\n", + " person[code] = dict1\n", + "filename = 'data/高新区.json'\n", + "with open(filename, 'w') as fl:\n", + " json.dump(person, fl, ensure_ascii=False)\n", + "print('ok')" + ] + }, + { + "cell_type": "markdown", + "id": "502638d8-79d0-4392-953e-047c8428c9a5", + "metadata": {}, + "source": [ + "## 统计测评人员" + ] + }, + { + "cell_type": "markdown", + "id": "a430da5f-1e5c-447f-96a1-344d03e57b31", + "metadata": {}, + "source": [ + "### 统计心理测评人员" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "7609f3c3-5c52-4b92-a2d5-359bf4a45a10", + "metadata": { + "execution": { + "iopub.execute_input": "2023-04-21T07:01:46.516495Z", + "iopub.status.busy": "2023-04-21T07:01:46.515666Z", + "iopub.status.idle": "2023-04-21T07:01:46.605645Z", + "shell.execute_reply": "2023-04-21T07:01:46.604904Z", + "shell.execute_reply.started": "2023-04-21T07:01:46.516452Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "213\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "import csv\n", + "filename = 'data/高新区.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "cjry = set()\n", + "filename = 'data/Survey_20230421-psy.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n", + " cjry.add(line[2])\n", + "print(len(cjry))\n", + "list2 = []\n", + "for k, v in person.items(): \n", + " #if 'phone' in v.keys() and v['phone'] in cjry:\n", + " if 'phone' in v.keys() and v['phone'] not in cjry:\n", + " list2.append([k,dict1[str(k)]['name'],dict1[str(k)]['phone']])\n", + " \n", + "filename = 'data/高新未参加心理评估人员(20230421).xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "#sheet.append(title)\n", + "for row in list2:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)" + ] + }, + { + "cell_type": "markdown", + "id": "519d9b3a-d0d8-44aa-a17d-65e7f21f088b", + "metadata": {}, + "source": [ + "### 统计中医测评人员" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "fd2391c1-8d73-4714-8c20-42161b3eb493", + "metadata": { + "execution": { + "iopub.execute_input": "2023-04-21T07:03:35.174975Z", + "iopub.status.busy": "2023-04-21T07:03:35.174533Z", + "iopub.status.idle": "2023-04-21T07:03:35.240353Z", + "shell.execute_reply": "2023-04-21T07:03:35.239435Z", + "shell.execute_reply.started": "2023-04-21T07:03:35.174944Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "217\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "import csv\n", + "filename = 'data/高新区.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "cjry = set()\n", + "filename = 'data/Survey_20230421-tcm1.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n", + " cjry.add(line[2])\n", + "print(len(cjry))\n", + "list2 = []\n", + "for k, v in person.items(): \n", + " #if 'phone' in v.keys() and v['phone'] in cjry:\n", + " if 'phone' in v.keys() and v['phone'] not in cjry:\n", + " list2.append([k,dict1[str(k)]['name'],dict1[str(k)]['phone']])\n", + " \n", + "filename = 'data/高新未参加中医评估人员(20230421).xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "#sheet.append(title)\n", + "for row in list2:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)" + ] + }, + { + "cell_type": "markdown", + "id": "0b717a78-52db-4894-83c6-731a4935a02d", + "metadata": {}, + "source": [ + "### 统计信息缺少人员信息" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "fd5af221-9369-4eab-884c-06885c940d88", + "metadata": { + "execution": { + "iopub.execute_input": "2023-04-21T07:16:05.935096Z", + "iopub.status.busy": "2023-04-21T07:16:05.934235Z", + "iopub.status.idle": "2023-04-21T07:16:05.967884Z", + "shell.execute_reply": "2023-04-21T07:16:05.966719Z", + "shell.execute_reply.started": "2023-04-21T07:16:05.935054Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "235\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "import csv\n", + "filename = 'data/高新区.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "cjry = set()\n", + "filename = 'data/Survey_20230421.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n", + " cjry.add(line[2])\n", + "print(len(cjry))\n", + "phones = set()\n", + "for k, v in person.items(): \n", + " #if 'phone' in v.keys() and v['phone'] in cjry:\n", + " if 'phone' in v.keys():\n", + " phones.add(v['phone'])\n", + "list2 = []\n", + "for item in cjry: \n", + " if item not in phones:\n", + " list2.append(['','',item])\n", + "filename = 'data/高新缺失信息人员(20230421).xlsx'\n", + "wb = openpyxl.Workbook()\n", + "sheet = wb.active\n", + "#sheet.append(title)\n", + "for row in list2:\n", + " sheet.append(row)\n", + " \n", + "wb.save(filename)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "01933c1f-b7e8-46ff-8a52-f415fca82e27", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}