This commit is contained in:
512song@sina.com committed 2023-04-18 15:43:38 +08:00
1 parent 27f84bcc76
commit f2956bc524
1 file changed
+167 -1
+167 -1
View File
@@ -870,10 +870,176 @@
"print(f'共有{i}条记录被修改')"
]
},
{
"cell_type": "markdown",
"id": "76c5412f-f2ef-446a-903d-6b033b5bfd8a",
"metadata": {},
"source": [
"## 统计测评人员"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "38ae9a3f-b284-4407-ab6a-8e992dfd9759",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-18T07:32:25.113781Z",
"iopub.status.busy": "2023-04-18T07:32:25.113221Z",
"iopub.status.idle": "2023-04-18T07:32:25.511703Z",
"shell.execute_reply": "2023-04-18T07:32:25.510486Z",
"shell.execute_reply.started": "2023-04-18T07:32:25.113731Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"364\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"import csv\n",
"wb = openpyxl.load_workbook('data/淄博交警支队人员名单(排序花名册).xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"cjry = set()\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,2).value is None:\n",
" break\n",
" else: \n",
" phone = sheet.cell(n, 5).value \n",
" person.setdefault(phone, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value \n",
" xb = str(sheet.cell(n, 3).value)\n",
" if xb == '1':\n",
" sex = '男'\n",
" elif xb =='2':\n",
" sex = '女'\n",
" dict1['sex'] = sex\n",
" dict1['unit'] = sheet.cell(n, 1).value\n",
" person[phone] = dict1\n",
"list1 = []\n",
"filename = 'data/Survey_20230418-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",
" \n",
" if k not in cjry:\n",
" list2.append([k,person[k]['name'],person[k]['unit']])\n",
" \n",
"filename = 'data/交警支队未参加中医评估人员(20230417).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": "113e45e5-403f-4d5d-9b96-adb7f05780f9",
"metadata": {},
"source": [
"### 统计未明确人员"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "d54bd635-c0d8-4527-811f-6d28f9cf68ae",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-18T07:40:24.190737Z",
"iopub.status.busy": "2023-04-18T07:40:24.190063Z",
"iopub.status.idle": "2023-04-18T07:40:24.456429Z",
"shell.execute_reply": "2023-04-18T07:40:24.455475Z",
"shell.execute_reply.started": "2023-04-18T07:40:24.190686Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"364\n",
"13626435432\n",
"13869376228\n",
"15253398050\n",
"18705336103\n",
"13853396557\n",
"15210715398\n",
"15864958332\n",
"15692336276\n",
"13718887655\n",
"13573380243\n",
"15801353667\n",
"15963308605\n",
"13953342555\n",
"13508956688\n",
"13969301299\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"import csv\n",
"wb = openpyxl.load_workbook('data/淄博交警支队人员名单(排序花名册).xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"cjry = set()\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,2).value is None:\n",
" break\n",
" else: \n",
" phone = sheet.cell(n, 5).value \n",
" person.setdefault(phone, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 2).value \n",
" xb = str(sheet.cell(n, 3).value)\n",
" if xb == '1':\n",
" sex = '男'\n",
" elif xb =='2':\n",
" sex = '女'\n",
" dict1['sex'] = sex\n",
" dict1['unit'] = sheet.cell(n, 1).value\n",
" person[phone] = dict1\n",
"list1 = []\n",
"filename = 'data/Survey_20230418-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 item in cjry:\n",
" if str(item) not in person.keys():\n",
" print(item)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ad27154a-ceae-4412-bd87-75d6040eb5d5",
"id": "908df4fc-254f-4525-a199-e0b82469af81",
"metadata": {},
"outputs": [],
"source": []