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

+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": []