20251114
This commit is contained in:
1 parent
f3a7c981d5
commit
48f119d087
5 files changed
+1196
-131
No files matched your search
+238
-12
@@ -3186,10 +3186,26 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 57,
|
||||
"id": "7b79c7bb-ce87-44b2-95b1-01e9cb66d5f0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-13T05:44:27.934101Z",
|
||||
"iopub.status.busy": "2025-11-13T05:44:27.933541Z",
|
||||
"iopub.status.idle": "2025-11-13T05:44:27.991293Z",
|
||||
"shell.execute_reply": "2025-11-13T05:44:27.990805Z",
|
||||
"shell.execute_reply.started": "2025-11-13T05:44:27.934053Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"759\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
@@ -3200,7 +3216,7 @@
|
||||
"filename = 'data/北海炼化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/marks_20251110.csv'\n",
|
||||
"filename = 'data/marks_20251113.csv'\n",
|
||||
"re_ta = My.get_result(filename,dict1)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -3210,6 +3226,58 @@
|
||||
"print(len(re_ta))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a7d2b973-cc05-4f06-9be8-54268a29dd84",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导入手工数据"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 60,
|
||||
"id": "458725a6-3b5b-48a1-af90-cd4d0bda3635",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-13T05:51:01.753768Z",
|
||||
"iopub.status.busy": "2025-11-13T05:51:01.752925Z",
|
||||
"iopub.status.idle": "2025-11-13T05:51:01.812931Z",
|
||||
"shell.execute_reply": "2025-11-13T05:51:01.812381Z",
|
||||
"shell.execute_reply.started": "2025-11-13T05:51:01.753692Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/北海炼化俯卧撑手工数据(2025年).xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"filename = 'data/result_北海2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = str(sheet.cell(n, 1).value)\n",
|
||||
" dict1[code].setdefault('pushup',{})\n",
|
||||
" dict1[code]['pushup']['成绩'] = str(sheet.cell(n,2).value)\n",
|
||||
"filename = 'data/result_北海2025.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "12b33ee8-2b4e-4b85-9301-4fbcadf4129c",
|
||||
@@ -3220,9 +3288,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 53,
|
||||
"id": "ca079428-2df9-4f15-b141-2c83cd0efaf5",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-11T09:33:39.776590Z",
|
||||
"iopub.status.busy": "2025-11-11T09:33:39.775794Z",
|
||||
"iopub.status.idle": "2025-11-11T09:33:39.805844Z",
|
||||
"shell.execute_reply": "2025-11-11T09:33:39.805299Z",
|
||||
"shell.execute_reply.started": "2025-11-11T09:33:39.776523Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -3258,7 +3334,7 @@
|
||||
" list2 = [k,v['人数'],v['体测人数']]\n",
|
||||
" list1.append(list2)\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化部门测试情况(截至20251110).xlsx'\n",
|
||||
"filename = 'data/北海炼化部门测试情况(截至20251111).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -3278,9 +3354,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 54,
|
||||
"id": "482a3a46-31a6-433b-88a8-7cad228f853a",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-11T09:33:43.302910Z",
|
||||
"iopub.status.busy": "2025-11-11T09:33:43.302201Z",
|
||||
"iopub.status.idle": "2025-11-11T09:33:43.341073Z",
|
||||
"shell.execute_reply": "2025-11-11T09:33:43.339404Z",
|
||||
"shell.execute_reply.started": "2025-11-11T09:33:43.302855Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -3321,6 +3405,63 @@
|
||||
"## 问卷人员统计"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 65,
|
||||
"id": "0bbf2cb6-e7d9-4d0d-beba-77ac50082f05",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-13T06:17:23.628451Z",
|
||||
"iopub.status.busy": "2025-11-13T06:17:23.627881Z",
|
||||
"iopub.status.idle": "2025-11-13T06:17:23.729071Z",
|
||||
"shell.execute_reply": "2025-11-13T06:17:23.728586Z",
|
||||
"shell.execute_reply.started": "2025-11-13T06:17:23.628397Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"import time\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/sql_20251113.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",
|
||||
"filename = 'data/北海炼化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict3 = json.load(fl)\n",
|
||||
"\n",
|
||||
"phone = {}\n",
|
||||
"for k,v in dict3.items():\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" phone[str(v['phone'])] = k\n",
|
||||
"dict2 = {}\n",
|
||||
"list3 = []\n",
|
||||
"for item in list1: \n",
|
||||
" phone_num = str(item[0])[2:] \n",
|
||||
" if phone_num in phone:\n",
|
||||
" list2 = []\n",
|
||||
" content = json.loads(json.loads(item[1])) \n",
|
||||
" code = phone[phone_num]\n",
|
||||
" list2 = [code,dict3[code]['name'],dict3[code]['unit'],phone_num]\n",
|
||||
" list3.append(list2)\n",
|
||||
"title =['测试编号','姓名','部门','手机号码']\n",
|
||||
"filename = 'data/北海炼化问卷人员(截至20251113).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)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 43,
|
||||
@@ -3411,9 +3552,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 62,
|
||||
"id": "f67f63d1-be8a-47ef-b95f-bdfca9725838",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-13T06:00:49.916395Z",
|
||||
"iopub.status.busy": "2025-11-13T06:00:49.915561Z",
|
||||
"iopub.status.idle": "2025-11-13T06:00:50.043798Z",
|
||||
"shell.execute_reply": "2025-11-13T06:00:50.043247Z",
|
||||
"shell.execute_reply.started": "2025-11-13T06:00:49.916323Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -3476,10 +3625,87 @@
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "9cb5f45e-15e5-4cf5-b82f-38e33729bad8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导出测试人员信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 61,
|
||||
"id": "3a0f5f5d-2bf0-46c8-b796-661e2f44c60c",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-13T05:51:13.926738Z",
|
||||
"iopub.status.busy": "2025-11-13T05:51:13.925983Z",
|
||||
"iopub.status.idle": "2025-11-13T05:51:14.123325Z",
|
||||
"shell.execute_reply": "2025-11-13T05:51:14.122772Z",
|
||||
"shell.execute_reply.started": "2025-11-13T05:51:13.926666Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北海2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/北海炼化人员2025.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
" \n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(str(k).rjust(5,'0'))\n",
|
||||
" list2.append(v['name']) \n",
|
||||
" list2.append(dict2[k]['sex'])\n",
|
||||
" list2.append(dict2[k]['unit'])\n",
|
||||
" list2.append(dict2[k]['birth'])\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" list2.append(dict2[k]['phone'])\n",
|
||||
" else:\n",
|
||||
" list2.append('')\n",
|
||||
" \n",
|
||||
" if 'bmi' in v.keys():\n",
|
||||
" height = v['bmi']['成绩'].split(',')[0]\n",
|
||||
" weight = v['bmi']['成绩'].split(',')[1]\n",
|
||||
" list2.append(height)\n",
|
||||
" list2.append(weight)\n",
|
||||
" else:\n",
|
||||
" list2.append('')\n",
|
||||
" list2.append('')\n",
|
||||
" for item in items:\n",
|
||||
" if item in v.keys():\n",
|
||||
" list2.append(v[item]['成绩']) \n",
|
||||
" elif item =='name':\n",
|
||||
" list2.append(v[item])\n",
|
||||
" else:\n",
|
||||
" list2.append('')\n",
|
||||
" \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/北海炼化体测情况表(2025年).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",
|
||||
"id": "4b58eeae-089d-4007-ab5a-1e1e9e088dd7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user