This commit is contained in:
512song committed 2025-11-10 20:06:46 +08:00
1 parent 03de3b1663
commit f3a7c981d5
4 files changed
+408 -184

No files matched your search

+222 -177
View File
@@ -122,26 +122,10 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": null,
"id": "d2598172-cede-4baa-920e-3d676c079b7b",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-17T01:50:24.312281Z",
"iopub.status.busy": "2025-09-17T01:50:24.311666Z",
"iopub.status.idle": "2025-09-17T01:50:24.427182Z",
"shell.execute_reply": "2025-09-17T01:50:24.426684Z",
"shell.execute_reply.started": "2025-09-17T01:50:24.312223Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -2447,26 +2431,10 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": null,
"id": "c5846968-1f2e-46b5-a79c-e2f129e5c233",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-17T01:51:05.541822Z",
"iopub.status.busy": "2025-09-17T01:51:05.541072Z",
"iopub.status.idle": "2025-09-17T01:51:05.595736Z",
"shell.execute_reply": "2025-09-17T01:51:05.595210Z",
"shell.execute_reply.started": "2025-09-17T01:51:05.541754Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -2560,26 +2528,10 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": null,
"id": "601f707b-bd34-4966-b781-c520a0bf69dc",
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-24T07:03:16.793791Z",
"iopub.status.busy": "2024-12-24T07:03:16.793020Z",
"iopub.status.idle": "2024-12-24T07:03:16.938934Z",
"shell.execute_reply": "2024-12-24T07:03:16.938312Z",
"shell.execute_reply.started": "2024-12-24T07:03:16.793721Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"876\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -2802,26 +2754,10 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": null,
"id": "98e43475-06ca-42bc-b352-5c92a554e2c2",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-17T02:01:52.580879Z",
"iopub.status.busy": "2025-09-17T02:01:52.580448Z",
"iopub.status.idle": "2025-09-17T02:01:52.867257Z",
"shell.execute_reply": "2025-09-17T02:01:52.866600Z",
"shell.execute_reply.started": "2025-09-17T02:01:52.580841Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
@@ -3106,26 +3042,10 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "58f6dbab-9ea2-4295-ae78-36951b67c2d3",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-31T04:59:33.610242Z",
"iopub.status.busy": "2025-10-31T04:59:33.609508Z",
"iopub.status.idle": "2025-10-31T04:59:33.725719Z",
"shell.execute_reply": "2025-10-31T04:59:33.725272Z",
"shell.execute_reply.started": "2025-10-31T04:59:33.610173Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"854 ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -3163,26 +3083,10 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "dbe52ce7-f801-44c6-b675-f0a84867c4d9",
"metadata": {
"execution": {
"iopub.execute_input": "2025-10-31T04:59:36.768146Z",
"iopub.status.busy": "2025-10-31T04:59:36.767582Z",
"iopub.status.idle": "2025-10-31T04:59:36.787010Z",
"shell.execute_reply": "2025-10-31T04:59:36.786336Z",
"shell.execute_reply.started": "2025-10-31T04:59:36.768082Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"854 ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -3215,27 +3119,10 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": null,
"id": "2d7f5a24-f247-4199-a84d-dcf611dbeef6",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-09T03:44:07.995486Z",
"iopub.status.busy": "2025-11-09T03:44:07.994757Z",
"iopub.status.idle": "2025-11-09T03:44:08.011078Z",
"shell.execute_reply": "2025-11-09T03:44:08.010474Z",
"shell.execute_reply.started": "2025-11-09T03:44:07.995415Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"880 熊峰 公用工程部\n",
"879 ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -3262,6 +3149,33 @@
"print(len(dict1),'ok')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f143e8d3-9e9a-4c27-be8c-88a3e5f94f51",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"filename = 'data/北海炼化人员2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/data_北海2025.json'\n",
"with open(filename,'r') as fl:\n",
" list1 = json.load(fl)\n",
"for item in list1:\n",
" code = item['id'].lower()\n",
" if code in dict1.keys():\n",
" \n",
" dict1[code]['unit'] = item['unit']\n",
"filename = 'data/北海炼化人员2025.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False)\n",
"print(len(dict1),'ok')"
]
},
{
"cell_type": "markdown",
"id": "cccfebad-8fc5-4aa9-b15d-05eff2fa421f",
@@ -3272,26 +3186,10 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": null,
"id": "7b79c7bb-ce87-44b2-95b1-01e9cb66d5f0",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-09T03:44:19.407046Z",
"iopub.status.busy": "2025-11-09T03:44:19.406684Z",
"iopub.status.idle": "2025-11-09T03:44:19.448052Z",
"shell.execute_reply": "2025-11-09T03:44:19.447526Z",
"shell.execute_reply.started": "2025-11-09T03:44:19.407015Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"558\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import datetime\n",
@@ -3302,7 +3200,7 @@
"filename = 'data/北海炼化人员2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/marks_20251109.csv'\n",
"filename = 'data/marks_20251110.csv'\n",
"re_ta = My.get_result(filename,dict1)\n",
"\n",
"\n",
@@ -3322,17 +3220,9 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"id": "ca079428-2df9-4f15-b141-2c83cd0efaf5",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-09T03:44:28.010017Z",
"iopub.status.busy": "2025-11-09T03:44:28.009339Z",
"iopub.status.idle": "2025-11-09T03:44:28.035577Z",
"shell.execute_reply": "2025-11-09T03:44:28.035016Z",
"shell.execute_reply.started": "2025-11-09T03:44:28.009952Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -3368,7 +3258,7 @@
" list2 = [k,v['人数'],v['体测人数']]\n",
" list1.append(list2)\n",
"\n",
"filename = 'data/北海炼化部门测试情况(截至20251109).xlsx'\n",
"filename = 'data/北海炼化部门测试情况(截至20251110).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
@@ -3388,17 +3278,9 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": null,
"id": "482a3a46-31a6-433b-88a8-7cad228f853a",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-09T03:44:34.970909Z",
"iopub.status.busy": "2025-11-09T03:44:34.970151Z",
"iopub.status.idle": "2025-11-09T03:44:35.005510Z",
"shell.execute_reply": "2025-11-09T03:44:35.005025Z",
"shell.execute_reply.started": "2025-11-09T03:44:34.970841Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -3421,7 +3303,7 @@
" i+=1\n",
" list1.append(list2)\n",
"#print(list1)\n",
"filename = f'data/北海炼化未测试人员名单(截至20251109).xlsx'\n",
"filename = f'data/北海炼化未测试人员名单(截至20251110).xlsx'\n",
"title = ['序号','员工编号','姓名','部门']\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
@@ -3431,10 +3313,173 @@
"wb.save(filename)"
]
},
{
"cell_type": "markdown",
"id": "bafcb189-a7b4-45bc-977a-9d7893938184",
"metadata": {},
"source": [
"## 问卷人员统计"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "277fce35-2f95-4d52-8cab-4e27c9acd7b8",
"metadata": {
"execution": {
"iopub.execute_input": "2025-11-10T09:40:12.759033Z",
"iopub.status.busy": "2025-11-10T09:40:12.758367Z",
"iopub.status.idle": "2025-11-10T09:40:12.843476Z",
"shell.execute_reply": "2025-11-10T09:40:12.842924Z",
"shell.execute_reply.started": "2025-11-10T09:40:12.758969Z"
}
},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"import time\n",
"from datetime import date\n",
"\n",
"\n",
"dict1 = {}\n",
"list1 = []\n",
"list2 = set()\n",
"filename = 'data/sql_20251110.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",
" list1.append(line)\n",
"nn = 0\n",
"for item in list1:\n",
" dict2 = {} \n",
" phone = str(item[0])[2:]\n",
" content = json.loads(json.loads(item[1]))\n",
" tcm = []\n",
" for i in range(0,60):\n",
" tcm.append(0)\n",
" for k, v in content.items(): \n",
" if 'tcm' not in k:\n",
" dict2[k] = v\n",
" else:\n",
" i = int(k[3:])\n",
" tcm[i-1] = int(v)\n",
" \n",
" code = phone\n",
" list2.add(code)\n",
" dict1.setdefault(code,{})\n",
" dict1[code]['name'] = content['name']\n",
" if content['gender'] == 'male':\n",
" dict1[code]['sex'] = '男'\n",
" else:\n",
" dict1[code]['sex'] = '女'\n",
" dict1[code]['birth'] = str(content['birth'])\n",
"filename = 'data/北海炼化人员2025.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"\n",
"i = 1\n",
"list3 = []\n",
"for k,v in dict2.items():\n",
" phone = str(v['phone'])\n",
" if phone not in list2:\n",
" list4 = []\n",
" list4 = [phone,v['name'],v['unit']]\n",
" list3.append(list4)\n",
"title =['手机号码','姓名','部门']\n",
"filename = 'data/北海炼化未参加问卷人员(截至20251110).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
"for row in list3:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename)\n",
"\n",
" "
]
},
{
"cell_type": "markdown",
"id": "e67ca2e1-a537-4eb4-9494-bfcf77139078",
"metadata": {},
"source": [
"## 问卷信息统计"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "38024bd4-7d11-43df-956a-a62ee6bf176e",
"id": "f67f63d1-be8a-47ef-b95f-bdfca9725838",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"import time\n",
"from datetime import date\n",
"\n",
"\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/sql_20251110.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",
" list1.append(line)\n",
"nn = 0\n",
"for item in list1:\n",
" dict2 = {}\n",
" \n",
" phone = str(item[0])[2:]\n",
" content = json.loads(json.loads(item[1]))\n",
" tcm = []\n",
" for i in range(0,60):\n",
" tcm.append(0)\n",
" for k, v in content.items(): \n",
" if 'tcm' not in k:\n",
" dict2[k] = v\n",
" else:\n",
" i = int(k[3:])\n",
" tcm[i-1] = int(v)\n",
" \n",
" code = phone\n",
" dict1.setdefault(code,{})\n",
" dict1[code]['name'] = content['name']\n",
" if content['gender'] == 'male':\n",
" dict1[code]['sex'] = '男'\n",
" else:\n",
" dict1[code]['sex'] = '女'\n",
" dict1[code]['birth'] = str(content['birth'])\n",
" dict1[code]['unit'] = '北海炼化'\n",
" #dict1[code]['phone'] = phone\n",
" #dict1[code]['weight'] = dict2['weight']\n",
" #dict1[code]['waist'] = dict2['waist']\n",
" #dict1[code]['hip'] = dict2['hip']\n",
" dict1[code]['tcm'] = tcm\n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" list2 = [k,v['name'],v['sex'],v['birth']]\n",
" list1.append(list2)\n",
"title =['手机号码','姓名','性别','出生年月']\n",
"filename = 'data/北海炼化问卷人员(截至20251110).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)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9cfbb3cd-8c5f-4353-b2fe-1eab7fa9ba6e",
"metadata": {},
"outputs": [],
"source": []