This commit is contained in:
512song committed 2024-10-10 18:53:00 +08:00
1 parent 47bc01514d
commit 31482fb2f5
3 files changed
+248 -510

No files matched your search

+66 -45
View File
@@ -853,15 +853,15 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 29,
"id": "096e2b97-b83c-46bb-a070-c816e47da331",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T11:24:04.312970Z",
"iopub.status.busy": "2024-10-08T11:24:04.312362Z",
"iopub.status.idle": "2024-10-08T11:24:04.343448Z",
"shell.execute_reply": "2024-10-08T11:24:04.342837Z",
"shell.execute_reply.started": "2024-10-08T11:24:04.312912Z"
"iopub.execute_input": "2024-10-10T04:16:54.343310Z",
"iopub.status.busy": "2024-10-10T04:16:54.342554Z",
"iopub.status.idle": "2024-10-10T04:16:54.374304Z",
"shell.execute_reply": "2024-10-10T04:16:54.373814Z",
"shell.execute_reply.started": "2024-10-10T04:16:54.343239Z"
}
},
"outputs": [
@@ -980,15 +980,15 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 34,
"id": "808e65e9-a9e3-44ea-9c0b-359375dceb3d",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T11:25:26.759557Z",
"iopub.status.busy": "2024-10-08T11:25:26.758847Z",
"iopub.status.idle": "2024-10-08T11:25:26.779018Z",
"shell.execute_reply": "2024-10-08T11:25:26.778247Z",
"shell.execute_reply.started": "2024-10-08T11:25:26.759489Z"
"iopub.execute_input": "2024-10-10T04:19:58.591580Z",
"iopub.status.busy": "2024-10-10T04:19:58.591086Z",
"iopub.status.idle": "2024-10-10T04:19:58.613839Z",
"shell.execute_reply": "2024-10-10T04:19:58.613230Z",
"shell.execute_reply.started": "2024-10-10T04:19:58.591535Z"
}
},
"outputs": [],
@@ -1067,15 +1067,15 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 31,
"id": "47f53bdf-ac6a-44f1-9f5f-852eb2d61127",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T11:28:23.464329Z",
"iopub.status.busy": "2024-10-08T11:28:23.462858Z",
"iopub.status.idle": "2024-10-08T11:28:23.485822Z",
"shell.execute_reply": "2024-10-08T11:28:23.485366Z",
"shell.execute_reply.started": "2024-10-08T11:28:23.464250Z"
"iopub.execute_input": "2024-10-10T04:17:31.723532Z",
"iopub.status.busy": "2024-10-10T04:17:31.722782Z",
"iopub.status.idle": "2024-10-10T04:17:31.746149Z",
"shell.execute_reply": "2024-10-10T04:17:31.745576Z",
"shell.execute_reply.started": "2024-10-10T04:17:31.723459Z"
}
},
"outputs": [
@@ -1083,19 +1083,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"13864709221\n",
"15542678894\n",
"13963385888\n",
"18562090935\n",
"16688150490\n",
"13181954355\n",
"13156800727\n",
"18661371563\n",
"15954633893\n",
"13864703202\n",
"13381366350\n",
"16688169676\n",
"13615461331\n"
"13381366350\n"
]
}
],
@@ -1161,10 +1153,47 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 33,
"id": "c633a37c-0f0e-4b81-83cb-a9fa49efbe36",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-10T04:18:31.164865Z",
"iopub.status.busy": "2024-10-10T04:18:31.164336Z",
"iopub.status.idle": "2024-10-10T04:18:31.173833Z",
"shell.execute_reply": "2024-10-10T04:18:31.172840Z",
"shell.execute_reply.started": "2024-10-10T04:18:31.164818Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 188 张世玉\n",
"2 37 孙傲\n",
"3 4 戴玮鹏\n",
"4 22 刘子童\n",
"5 52 李国欣\n",
"6 30 彭如旭\n",
"7 53 师立军\n",
"8 55 王瑞林\n",
"9 196 廉鹤\n",
"10 76 李春艳\n",
"11 26 沈妍\n",
"12 9 李霞\n",
"13 70 张双星\n",
"14 69 许晓东\n",
"15 3 余永姝\n",
"16 193 陈猛\n",
"17 36 牟宝磊\n",
"18 77 黄钰苹\n",
"19 71 吕晟琨\n",
"20 73 龚屹鹏\n",
"21 35 王思瑶\n",
"22 201 常鹏兵\n"
]
}
],
"source": [
"import json\n",
"import csv\n",
@@ -1185,26 +1214,18 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 32,
"id": "3f68bad7-e2ba-47e1-9ae0-08fce2ad79d1",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T11:20:59.790384Z",
"iopub.status.busy": "2024-10-08T11:20:59.789696Z",
"iopub.status.idle": "2024-10-08T11:20:59.798731Z",
"shell.execute_reply": "2024-10-08T11:20:59.797943Z",
"shell.execute_reply.started": "2024-10-08T11:20:59.790320Z"
"iopub.execute_input": "2024-10-10T04:18:20.092613Z",
"iopub.status.busy": "2024-10-10T04:18:20.092142Z",
"iopub.status.idle": "2024-10-10T04:18:20.099516Z",
"shell.execute_reply": "2024-10-10T04:18:20.098866Z",
"shell.execute_reply.started": "2024-10-10T04:18:20.092588Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"162\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import csv\n",
+18 -165
View File
@@ -431,15 +431,15 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 11,
"id": "3e614f4a-a623-48e2-97f8-b31f62c9a983",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T11:25:00.162666Z",
"iopub.status.busy": "2024-10-08T11:25:00.161915Z",
"iopub.status.idle": "2024-10-08T11:25:00.180116Z",
"shell.execute_reply": "2024-10-08T11:25:00.179490Z",
"shell.execute_reply.started": "2024-10-08T11:25:00.162592Z"
"iopub.execute_input": "2024-10-10T04:19:31.792657Z",
"iopub.status.busy": "2024-10-10T04:19:31.791903Z",
"iopub.status.idle": "2024-10-10T04:19:31.845405Z",
"shell.execute_reply": "2024-10-10T04:19:31.844817Z",
"shell.execute_reply.started": "2024-10-10T04:19:31.792583Z"
},
"tags": []
},
@@ -544,15 +544,15 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 12,
"id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T11:25:10.348657Z",
"iopub.status.busy": "2024-10-08T11:25:10.348028Z",
"iopub.status.idle": "2024-10-08T11:25:10.367430Z",
"shell.execute_reply": "2024-10-08T11:25:10.366876Z",
"shell.execute_reply.started": "2024-10-08T11:25:10.348595Z"
"iopub.execute_input": "2024-10-10T04:19:34.936239Z",
"iopub.status.busy": "2024-10-10T04:19:34.935929Z",
"iopub.status.idle": "2024-10-10T04:19:34.954873Z",
"shell.execute_reply": "2024-10-10T04:19:34.954373Z",
"shell.execute_reply.started": "2024-10-10T04:19:34.936209Z"
},
"tags": []
},
@@ -689,153 +689,6 @@
"print('ok!') "
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "30c4c256-a75d-40dd-b9cf-e3102fd4ab5a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T11:25:33.793524Z",
"iopub.status.busy": "2024-10-08T11:25:33.792822Z",
"iopub.status.idle": "2024-10-08T11:25:33.811389Z",
"shell.execute_reply": "2024-10-08T11:25:33.810061Z",
"shell.execute_reply.started": "2024-10-08T11:25:33.793457Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [
"import json\n",
"import time\n",
"\n",
"filename = '../item.json'\n",
"item = {}\n",
"unit = {}\n",
"with open(filename,'r') as fl:\n",
" dict3 = json.load(fl) \n",
"for k,v in dict3.items():\n",
" item[k] = v\n",
"item['1']['en'] = 'lung'\n",
"item['2']['en'] = 'grip'\n",
"item['3']['en'] = 'flexion'\n",
"item['4']['en'] = 'jump'\n",
"item['5']['en'] = 'pushup'\n",
"item['6']['en'] = 'balance'\n",
"item['7']['en'] = 'reaction'\n",
"item['8']['en'] = 'step'\n",
"item['9']['en'] = 'situp'\n",
"item['10']['en'] = 'height'\n",
"item['11']['en'] = 'weight'\n",
"\n",
"filename = 'data/体质检测标准 (1).json' \n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"\n",
"\n",
"def cal_score(data1):\n",
" #data = {'name':'张三','sex':'M','age':37,'item':'StepExperiment','result':46} \n",
" person = dict1['person']\n",
" criteria = dict1['criteria']\n",
" if data1['age'] >59:\n",
" data1['age'] = 59\n",
" if data1['age'] <20:\n",
" data1['age'] = 20\n",
" info = data1['sex']+str(data1['age'])\n",
" bz = person[info]\n",
" mx = criteria[bz][data1['item']]\n",
" result = data1['result'] \n",
" if data1['item'] == 'reaction':\n",
" for bz1 in mx:\n",
" if result > bz1:\n",
" #print(bz1)\n",
" score = mx.index(bz1,0)\n",
" break\n",
" else:\n",
" score = 5\n",
" else:\n",
" for bz1 in mx:\n",
" if result < bz1:\n",
" #print(bz1)\n",
" score = mx.index(bz1,0)\n",
" break\n",
" else:\n",
" score = 5\n",
" return(score)\n",
"filename = 'data/体质检测标准_BMI.json'\n",
"with open(filename,'r') as fl:\n",
" dict4 = json.load(fl) \n",
" \n",
"def cal_bmi(data1):\n",
" # data = {'name':'张三','sex':'M','age':37,'item':'HeightWeight','result':'177.7,97.0'}\n",
" person = dict4['person']\n",
" criteria = dict4['criteria']\n",
" if data1['age'] > 59:\n",
" data1['age'] = 59\n",
" if data1['age'] <20:\n",
" data1['age'] = 20\n",
" info = data1['sex']+str(data1['age'])\n",
" bz = person[info]\n",
" #print(bz)\n",
" result = data1['result']\n",
" #print(data1['code'],result)\n",
" height = int(float(result.split(',')[0]))\n",
" weight = float(result.split(',')[1])\n",
" if str(height) not in criteria[bz]:\n",
" score = 1\n",
" else: \n",
" mx = criteria[bz][str(height)]\n",
" if weight < mx[0]:\n",
" score = 1\n",
" elif weight < mx[1]:\n",
" score = 3\n",
" elif weight < mx[2]:\n",
" score = 5 \n",
" elif weight <= mx[3]:\n",
" score = 3 \n",
" elif weight > mx[3]:\n",
" score = 1\n",
" return score\n",
" \n",
" \n",
"\n",
"#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_样本.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
" #print(k)\n",
" if v['sex'] == '男':\n",
" sex = 'M'\n",
" else:\n",
" sex = 'F' \n",
" if 'height' in v.keys() and 'weight' in v.keys():\n",
" bmi_data = v['height']['成绩'].split()[0]+','+ v['weight']['成绩'].split()[0]\n",
" data1 = {'code':k,'sex':sex,'age':v['age'],'item':'HeightWeight','result':bmi_data}\n",
" dict2[k]['bmi'] = {}\n",
" dict2[k]['bmi']['成绩'] = bmi_data\n",
" dict2[k]['bmi']['score'] = cal_bmi(data1)\n",
" for item_en in list_item:\n",
" if item_en in v.keys(): \n",
" data1 = {'code':k,'sex':sex,'age':v['age'],'item':item_en,'result':float(v[item_en]['成绩'].split()[0])}\n",
" dict2[k][item_en]['score'] = cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n",
"filename = f'data/result_样本.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
]
},
{
"cell_type": "markdown",
"id": "ceef0742-f62a-4a7d-b0d5-be7ae7abb741",
@@ -846,15 +699,15 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 13,
"id": "b123ee6b-85d2-4660-b226-321832a6b796",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-08T11:25:43.507759Z",
"iopub.status.busy": "2024-10-08T11:25:43.506935Z",
"iopub.status.idle": "2024-10-08T11:26:24.811404Z",
"shell.execute_reply": "2024-10-08T11:26:24.810202Z",
"shell.execute_reply.started": "2024-10-08T11:25:43.507684Z"
"iopub.execute_input": "2024-10-10T04:22:38.050651Z",
"iopub.status.busy": "2024-10-10T04:22:38.049905Z",
"iopub.status.idle": "2024-10-10T04:23:20.183719Z",
"shell.execute_reply": "2024-10-10T04:23:20.182527Z",
"shell.execute_reply.started": "2024-10-10T04:22:38.050579Z"
},
"tags": []
},
+164 -300
View File
@@ -159,17 +159,9 @@
},
{
"cell_type": "code",
"execution_count": 108,
"execution_count": null,
"id": "bc79f0d2-62a2-40c8-bd74-9c7ff17bec8e",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T06:59:45.541438Z",
"iopub.status.busy": "2024-09-30T06:59:45.540672Z",
"iopub.status.idle": "2024-09-30T06:59:46.017490Z",
"shell.execute_reply": "2024-09-30T06:59:46.016942Z",
"shell.execute_reply.started": "2024-09-30T06:59:45.541365Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -534,6 +526,90 @@
"print('ok!') "
]
},
{
"cell_type": "markdown",
"id": "bb0f8c6f-5088-4c4d-a253-9c207745ef25",
"metadata": {},
"source": [
"## 生成体测成绩明细表"
]
},
{
"cell_type": "code",
"execution_count": 152,
"id": "5cff3c83-b3cb-4c69-97a9-82e523374f6b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-10-10T10:47:36.933057Z",
"iopub.status.busy": "2024-10-10T10:47:36.932336Z",
"iopub.status.idle": "2024-10-10T10:47:37.343139Z",
"shell.execute_reply": "2024-10-10T10:47:37.342525Z",
"shell.execute_reply.started": "2024-10-10T10:47:36.932987Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
"bmi = ['height','weight']\n",
"title = ['编号','姓名','性别','单位/部门','身高','体重','bmi','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n",
"\n",
"filename = 'data/result_镇海2.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"list1 = []\n",
"for k, v in dict1.items(): #print(k,dict2[str(k)]['name'])\n",
" list2 = []\n",
" list2.append(str(k).rjust(5,'0'))\n",
" list2.append(dict1[k]['name']) \n",
" list2.append(dict1[k]['sex'])\n",
" list2.append(dict1[k]['unit'])\n",
" i = 0\n",
" if 'bmi' in dict1[k].keys():\n",
" list2.append(dict1[k]['height']['成绩'])\n",
" list2.append(dict1[k]['weight']['成绩'])\n",
" list2.append(dict1[k]['bmi']['score'])\n",
" i+=1\n",
" else:\n",
" list2.append('') \n",
" list2.append('') \n",
" list2.append('') \n",
" \n",
" \n",
" for item in items:\n",
" if item in dict1[k].keys():\n",
" list2.append(dict1[k][item]['成绩'])\n",
" list2.append(dict1[k][item]['score']) \n",
" i+=1\n",
" elif item =='name':\n",
" list2.append(dict1[k][item])\n",
" else:\n",
" list2.append('') \n",
" list2.append('') \n",
" if i>2:\n",
" list1.append(list2)\n",
"filename = 'data/镇海体测情况明细表.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)\n",
"print('ok') "
]
},
{
"cell_type": "markdown",
"id": "723ae3d7-ec16-4dc6-91e2-eeeea6ffe081",
@@ -680,27 +756,12 @@
},
{
"cell_type": "code",
"execution_count": 107,
"execution_count": null,
"id": "fa963fb6-b47d-4b75-9109-6cda89218182",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T06:58:38.490350Z",
"iopub.status.busy": "2024-09-30T06:58:38.489677Z",
"iopub.status.idle": "2024-09-30T06:58:38.708672Z",
"shell.execute_reply": "2024-09-30T06:58:38.708145Z",
"shell.execute_reply.started": "2024-09-30T06:58:38.490289Z"
},
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import glob\n",
@@ -1037,26 +1098,10 @@
},
{
"cell_type": "code",
"execution_count": 113,
"execution_count": null,
"id": "a550ecd7-da8e-41b6-8b8f-8bc144d48bfe",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T07:33:01.527422Z",
"iopub.status.busy": "2024-09-30T07:33:01.527168Z",
"iopub.status.idle": "2024-09-30T07:33:01.595828Z",
"shell.execute_reply": "2024-09-30T07:33:01.595271Z",
"shell.execute_reply.started": "2024-09-30T07:33:01.527399Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"782\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
@@ -1135,28 +1180,10 @@
},
{
"cell_type": "code",
"execution_count": 137,
"execution_count": null,
"id": "d5721244-b5f5-4577-bae8-2e6c5bd8e4da",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:09:20.461987Z",
"iopub.status.busy": "2024-09-30T08:09:20.460968Z",
"iopub.status.idle": "2024-09-30T08:09:20.476548Z",
"shell.execute_reply": "2024-09-30T08:09:20.475718Z",
"shell.execute_reply.started": "2024-09-30T08:09:20.461927Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"平均成绩:3.2405分,男性:313人\n",
"平均成绩:3.4483分,女性:92人\n",
"平均成绩:3.2877分,总体:405人\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"filename = 'data/data_镇海_白班.json'\n",
@@ -1193,31 +1220,10 @@
},
{
"cell_type": "code",
"execution_count": 138,
"execution_count": null,
"id": "cff50f06-3221-4340-950f-3a24073b8565",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:10:16.993594Z",
"iopub.status.busy": "2024-09-30T08:10:16.992995Z",
"iopub.status.idle": "2024-09-30T08:10:17.024014Z",
"shell.execute_reply": "2024-09-30T08:10:17.023470Z",
"shell.execute_reply.started": "2024-09-30T08:10:16.993539Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0~255分人数:27人,男性:24人,女性:3人\n",
"256~332分人数:155人,男性:131人,女性:24人\n",
"333~367分人数:146人,男性:104人,女性:42人\n",
"368~500分人数:77人,男性:54人,女性:23人\n",
"405\n",
"ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -1263,33 +1269,10 @@
},
{
"cell_type": "code",
"execution_count": 139,
"execution_count": null,
"id": "6baf0ff2-cdfa-4396-bcf8-3e23a18670dc",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:11:01.790765Z",
"iopub.status.busy": "2024-09-30T08:11:01.789996Z",
"iopub.status.idle": "2024-09-30T08:11:01.809947Z",
"shell.execute_reply": "2024-09-30T08:11:01.809201Z",
"shell.execute_reply.started": "2024-09-30T08:11:01.790691Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {'合格': 1, '良好': 3, '优秀': 0}\n",
"25-29 {'良好': 9, '合格': 11, '优秀': 3, '不合格': 0}\n",
"30-34 {'合格': 6, '优秀': 5, '良好': 12, '不合格': 2}\n",
"35-39 {'良好': 6, '合格': 3, '不合格': 1, '优秀': 5}\n",
"40-44 {'良好': 5, '合格': 1, '优秀': 1}\n",
"45-49 {'合格': 2, '优秀': 6, '良好': 4, '不合格': 0}\n",
"50-54 {'良好': 3, '不合格': 0, '优秀': 2, '合格': 0}\n",
"55-80 {'优秀': 1, '合格': 0, '良好': 0, '不合格': 0}\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1329,33 +1312,10 @@
},
{
"cell_type": "code",
"execution_count": 140,
"execution_count": null,
"id": "2979cf80-5268-4754-ab8a-11a539315e92",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:11:49.628176Z",
"iopub.status.busy": "2024-09-30T08:11:49.627421Z",
"iopub.status.idle": "2024-09-30T08:11:49.647219Z",
"shell.execute_reply": "2024-09-30T08:11:49.646522Z",
"shell.execute_reply.started": "2024-09-30T08:11:49.628086Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {'合格': 8, '良好': 3, '优秀': 3}\n",
"25-29 {'良好': 24, '合格': 33, '优秀': 6, '不合格': 6}\n",
"30-34 {'合格': 21, '优秀': 5, '良好': 15, '不合格': 7}\n",
"35-39 {'良好': 19, '合格': 28, '不合格': 4, '优秀': 13}\n",
"40-44 {'良好': 12, '合格': 8, '优秀': 7}\n",
"45-49 {'合格': 10, '优秀': 4, '良好': 7, '不合格': 1}\n",
"50-54 {'良好': 16, '不合格': 4, '优秀': 9, '合格': 11}\n",
"55-80 {'优秀': 7, '合格': 12, '良好': 8, '不合格': 2}\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1395,33 +1355,10 @@
},
{
"cell_type": "code",
"execution_count": 141,
"execution_count": null,
"id": "8a7cb3b0-d7be-44ac-a1ec-40bdcf29e83b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:12:43.756100Z",
"iopub.status.busy": "2024-09-30T08:12:43.755357Z",
"iopub.status.idle": "2024-09-30T08:12:43.770919Z",
"shell.execute_reply": "2024-09-30T08:12:43.769768Z",
"shell.execute_reply.started": "2024-09-30T08:12:43.756030Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"16~24岁平均成绩:3.24分,人数:18人,男性:14人\n",
"25~29岁平均成绩:3.18分,人数:92人,男性:69人\n",
"30~34岁平均成绩:3.19分,人数:73人,男性:48人\n",
"35~39岁平均成绩:3.33分,人数:79人,男性:64人\n",
"40~44岁平均成绩:3.43分,人数:34人,男性:27人\n",
"45~49岁平均成绩:3.45分,人数:34人,男性:22人\n",
"50~54岁平均成绩:3.38分,人数:45人,男性:40人\n",
"55~69岁平均成绩:3.3分,人数:30人,男性:29人\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n",
"\n",
@@ -1456,33 +1393,10 @@
},
{
"cell_type": "code",
"execution_count": 142,
"execution_count": null,
"id": "c5bb03ca-b7ee-4564-b425-8513e1bff081",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:13:35.726671Z",
"iopub.status.busy": "2024-09-30T08:13:35.725976Z",
"iopub.status.idle": "2024-09-30T08:13:35.738750Z",
"shell.execute_reply": "2024-09-30T08:13:35.737676Z",
"shell.execute_reply.started": "2024-09-30T08:13:35.726606Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:3.21分,人数:14人\n",
"25~29岁平均成绩:3.13分,人数:69人\n",
"30~34岁平均成绩:3.1分,人数:48人\n",
"35~39岁平均成绩:3.3分,人数:64人\n",
"40~44岁平均成绩:3.44分,人数:27人\n",
"45~49岁平均成绩:3.28分,人数:22人\n",
"50~54岁平均成绩:3.34分,人数:40人\n",
"55~80岁平均成绩:3.28分,人数:29人\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -1517,33 +1431,10 @@
},
{
"cell_type": "code",
"execution_count": 143,
"execution_count": null,
"id": "bf333998-230c-4365-aadc-b0d1be073b39",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:14:20.172349Z",
"iopub.status.busy": "2024-09-30T08:14:20.171955Z",
"iopub.status.idle": "2024-09-30T08:14:20.181587Z",
"shell.execute_reply": "2024-09-30T08:14:20.180965Z",
"shell.execute_reply.started": "2024-09-30T08:14:20.172326Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:3.37分,人数:4人\n",
"25~29岁平均成绩:3.31分,人数:23人\n",
"30~34岁平均成绩:3.36分,人数:25人\n",
"35~39岁平均成绩:3.48分,人数:15人\n",
"40~44岁平均成绩:3.4分,人数:7人\n",
"45~49岁平均成绩:3.77分,人数:12人\n",
"50~54岁平均成绩:3.71分,人数:5人\n",
"55~80岁平均成绩:4.0分,人数:1人\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1576,35 +1467,10 @@
},
{
"cell_type": "code",
"execution_count": 144,
"execution_count": null,
"id": "352c6c29-8929-4210-84c5-8dbc3d5ffeee",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:15:17.750779Z",
"iopub.status.busy": "2024-09-30T08:15:17.750013Z",
"iopub.status.idle": "2024-09-30T08:15:17.769711Z",
"shell.execute_reply": "2024-09-30T08:15:17.768948Z",
"shell.execute_reply.started": "2024-09-30T08:15:17.750706Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"BMI 4.07 404\n",
"肺活量 3.59 405\n",
"握力 3.13 403\n",
"坐位体前屈 2.98 400\n",
"纵跳 3.48 394\n",
"俯卧撑 3.8 308\n",
"一分钟仰卧起坐 4.58 78\n",
"单脚站立 2.78 397\n",
"选择反应时 3.02 388\n",
"台阶指数 2.6 381\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
@@ -1629,57 +1495,10 @@
},
{
"cell_type": "code",
"execution_count": 145,
"execution_count": null,
"id": "97f5a1cf-341e-4b99-9549-b6a3fb165849",
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-30T08:16:03.902202Z",
"iopub.status.busy": "2024-09-30T08:16:03.901487Z",
"iopub.status.idle": "2024-09-30T08:16:03.914044Z",
"shell.execute_reply": "2024-09-30T08:16:03.913182Z",
"shell.execute_reply.started": "2024-09-30T08:16:03.902118Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"采购中心 3.39 20\n",
"公用工程一部 3.28 24\n",
"炼油二部 3.21 8\n",
"事务中心 3.19 32\n",
"公司机关 3.31 83\n",
"储运一部 3.29 26\n",
"仪表和计量中心 3.31 22\n",
"项目管理部 3.36 17\n",
"港储部 3.0 7\n",
"电气中心 3.18 5\n",
"公用工程二部 3.26 13\n",
"炼油五部 3.56 16\n",
"消防支队 3.14 6\n",
"新材料研究院 3.21 11\n",
"合成材料部 3.47 9\n",
"氢能制造部 3.19 4\n",
"油库中心 3.3 17\n",
"炼油三部 3.46 8\n",
"质管中心 3.2 11\n",
"烯烃一部 3.41 21\n",
"化学制品部 3.51 5\n",
"炼油六部 3.17 6\n",
"炼油一部 3.24 10\n",
"宣传部 3.11 1\n",
"财务部 3.0 1\n",
"生产部 3.04 3\n",
"发展部 2.78 4\n",
"项目部 2.7 2\n",
"炼油四部 3.25 4\n",
"烯烃二部 3.13 6\n",
"炼油七部 2.89 1\n",
"储运二部 3.44 2\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
@@ -1698,10 +1517,55 @@
" print(item,round(score/n,2),n)"
]
},
{
"cell_type": "markdown",
"id": "d8e995d6-3ddb-4b92-8255-530e8a3da179",
"metadata": {},
"source": [
"## 计算部门成绩"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0d043ccc-a241-4b72-912f-7609d3f794a7",
"id": "a959c1b8-86fc-4fca-8595-4278135e95b8",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"items = ['BMI','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数'] \n",
"filename = 'data/data_镇海.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/镇海体测人员.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"dict3 = {}\n",
"\n",
"for k, v in dict1.items():\n",
" unit = v['unit']\n",
" dict3.setdefault(unit,{})\n",
" for item in items:\n",
" dict3[unit].setdefault(item,{})\n",
" dict3[unit][item].setdefault('score',0)\n",
" dict3[unit][item].setdefault('count',0)\n",
" for k1,v1 in v['fits'].items():\n",
" if k1 in items:\n",
" dict3[unit][k1]['score']+=v1['score']\n",
" dict3[unit][k1]['count']+=1\n",
"\n",
"for k, v in dict3.items():\n",
" print(k)\n",
" for k1, v1 in v.items():\n",
" print(k1,v1['score'],v1['count'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "62647f93-2d98-4ab1-bd05-989c318b673d",
"metadata": {},
"outputs": [],
"source": []