This commit is contained in:
512song committed 2023-10-10 20:58:37 +08:00
1 parent 3017b0ab48
commit 1033d6ca9d
4 files changed
+532 -97

No files matched your search

+475 -40
View File
@@ -414,27 +414,10 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "edcd9c2d-7254-493d-82e0-55556700330b",
"metadata": {
"execution": {
"iopub.execute_input": "2023-08-16T08:53:29.466349Z",
"iopub.status.busy": "2023-08-16T08:53:29.465563Z",
"iopub.status.idle": "2023-08-16T08:53:30.567398Z",
"shell.execute_reply": "2023-08-16T08:53:30.566465Z",
"shell.execute_reply.started": "2023-08-16T08:53:29.466307Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'str'>\n",
"{\"errmsg\":\"ok\"}\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import json\n",
@@ -467,27 +450,10 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "0b528b37-18f5-4b05-bfad-73be35b120cc",
"metadata": {
"execution": {
"iopub.execute_input": "2023-08-26T01:22:01.984551Z",
"iopub.status.busy": "2023-08-26T01:22:01.983645Z",
"iopub.status.idle": "2023-08-26T01:22:02.822718Z",
"shell.execute_reply": "2023-08-26T01:22:02.821896Z",
"shell.execute_reply.started": "2023-08-26T01:22:01.984511Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'str'>\n",
"{\"errmsg\":\"ok\"}\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import json\n",
@@ -837,6 +803,475 @@
" sheet.append(row)\n",
"wb.save(filename) "
]
},
{
"cell_type": "markdown",
"id": "2ae502e4-e8ec-4786-8593-ca8835c0b215",
"metadata": {},
"source": [
"## 分析三月数据"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "bc0e659e-b072-4ffc-9a9f-951c61ad22b9",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-10T11:12:02.250010Z",
"iopub.status.busy": "2023-10-10T11:12:02.249552Z",
"iopub.status.idle": "2023-10-10T11:12:02.315587Z",
"shell.execute_reply": "2023-10-10T11:12:02.314268Z",
"shell.execute_reply.started": "2023-10-10T11:12:02.249973Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"体重平均成绩:3.6196分,男性:184人\n",
"体重平均成绩:3.6765分,女性:204人\n",
"体重平均成绩:3.6495分,总体:388人\n",
"肺活量平均成绩:1.8865分,男性:185人\n",
"肺活量平均成绩:1.7122分,女性:205人\n",
"肺活量平均成绩:1.7949分,总体:390人\n",
"握力平均成绩:1.7838分,男性:185人\n",
"握力平均成绩:1.774分,女性:208人\n",
"握力平均成绩:1.7786分,总体:393人\n",
"坐位体前屈平均成绩:2.8764分,男性:178人\n",
"坐位体前屈平均成绩:2.9424分,女性:191人\n",
"坐位体前屈平均成绩:2.9106分,总体:369人\n",
"纵跳平均成绩:0.8421分,男性:57人\n",
"纵跳平均成绩:0.5513分,女性:78人\n",
"纵跳平均成绩:0.6741分,总体:135人\n",
"俯卧撑平均成绩:3.0333分,男性:30人\n",
"俯卧撑平均成绩:3.0333分,总体:30人\n",
"一分钟仰卧起坐平均成绩:3.2927分,女性:41人\n",
"一分钟仰卧起坐平均成绩:3.2927分,总体:41人\n",
"单脚站立平均成绩:1.6932分,男性:176人\n",
"单脚站立平均成绩:1.7135分,女性:192人\n",
"单脚站立平均成绩:1.7038分,总体:368人\n",
"选择反应时平均成绩:2.4725分,男性:182人\n",
"选择反应时平均成绩:2.2927分,女性:205人\n",
"选择反应时平均成绩:2.3773分,总体:387人\n",
"台阶指数平均成绩:3.475分,男性:40人\n",
"台阶指数平均成绩:3.6866分,女性:67人\n",
"台阶指数平均成绩:3.6075分,总体:107人\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"list1 = []\n",
"\n",
"wb = openpyxl.load_workbook('data/杨庙体测报告明细表.xlsx')\n",
"sheet = wb.active\n",
"items = ['bmi','lung','grip','flexion','balance','reaction']\n",
"dict1 = {}\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value) \n",
" list1.append(str(code)) \n",
"\n",
"\n",
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_杨庙社区2303.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"\n",
"for item in items:\n",
" m = 0\n",
" f = 0\n",
" score = 0\n",
" t_score = 0\n",
" for k,v in dict1.items():\n",
" if v['sex'] == 1 and item in v.keys() and k in list1:\n",
" #print(k)\n",
" \n",
" if v[item]['得分']!=\"\":\n",
" m = m +1\n",
" score = score+int(v[item]['得分'])\n",
" if m>0:\n",
" print(f'{item}平均成绩:{round(score/m,4)}分,男性:{m}人')\n",
" t_score = t_score + score\n",
" score = 0\n",
" for k,v in dict1.items():\n",
" if v['sex'] == 2 and item in v.keys() and k in list1:\n",
" \n",
" if v[item]['得分']!='':\n",
" f = f +1\n",
" score = score+int(v[item]['得分'])\n",
" if f >0:\n",
" print(f'{item}平均成绩:{round(score/f,4)}分,女性:{f}人')\n",
" t_score = t_score + score\n",
" if (f+m)>0:\n",
" print(f'{item}平均成绩:{round(t_score/(f+m),4)}分,总体:{f+m}人')\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "e35ed01c-9a45-4a3c-b391-1655223f0c08",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-10T11:23:00.446004Z",
"iopub.status.busy": "2023-10-10T11:23:00.445535Z",
"iopub.status.idle": "2023-10-10T11:23:00.495577Z",
"shell.execute_reply": "2023-10-10T11:23:00.494955Z",
"shell.execute_reply.started": "2023-10-10T11:23:00.445967Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"男性:187人\n",
"女性:208人\n",
"总体:395人\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"list1 = []\n",
"\n",
"wb = openpyxl.load_workbook('data/杨庙体测报告明细表.xlsx')\n",
"sheet = wb.active\n",
"items = ['bmi','lung','grip','flexion','balance','reaction']\n",
"dict1 = {}\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value) \n",
" list1.append(str(code)) \n",
"\n",
"\n",
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_杨庙社区2303.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"\n",
"m =0\n",
"f =0\n",
"for k,v in dict1.items():\n",
" if v['sex'] == 1 and k in list1:\n",
" m = m +1\n",
"print(f'男性:{m}人')\n",
"\n",
"for k,v in dict1.items():\n",
" if v['sex'] == 2 and k in list1:\n",
" f = f +1\n",
"print(f'女性:{f}人')\n",
"\n",
"print(f'总体:{f+m}人')"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "a3fd59cd-5b02-4b19-b91f-12aad60bcc97",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-10T11:15:19.155689Z",
"iopub.status.busy": "2023-10-10T11:15:19.155226Z",
"iopub.status.idle": "2023-10-10T11:15:19.226867Z",
"shell.execute_reply": "2023-10-10T11:15:19.225686Z",
"shell.execute_reply.started": "2023-10-10T11:15:19.155653Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"76\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"list1 = []\n",
"\n",
"wb = openpyxl.load_workbook('data/杨庙体测报告明细表.xlsx')\n",
"sheet = wb.active\n",
"items = ['bmi','lung','grip','flexion','balance','reaction']\n",
"dict1 = {}\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value) \n",
" list1.append(str(code)) \n",
"\n",
"\n",
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_杨庙社区2303.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"for item in list1:\n",
" if item not in dict1.keys():\n",
" print(item)"
]
},
{
"cell_type": "markdown",
"id": "55b49119-2d00-4b65-a5cb-4079c84ce188",
"metadata": {},
"source": [
"## 分析八月数据"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "0550886e-f3d7-4366-acdc-98d2aa879f98",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-10T11:35:05.533094Z",
"iopub.status.busy": "2023-10-10T11:35:05.532623Z",
"iopub.status.idle": "2023-10-10T11:35:05.617045Z",
"shell.execute_reply": "2023-10-10T11:35:05.616118Z",
"shell.execute_reply.started": "2023-10-10T11:35:05.533057Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bmi平均成绩:3.7597分,男性:258人\n",
"bmi平均成绩:3.7911分,女性:316人\n",
"bmi平均成绩:3.777分,总体:574人\n",
"lung平均成绩:1.8803分,男性:259人\n",
"lung平均成绩:1.652分,女性:319人\n",
"lung平均成绩:1.7543分,总体:578人\n",
"grip平均成绩:1.5328分,男性:259人\n",
"grip平均成绩:1.5063分,女性:318人\n",
"grip平均成绩:1.5182分,总体:577人\n",
"flexion平均成绩:2.2923分,男性:260人\n",
"flexion平均成绩:2.511分,女性:319人\n",
"flexion平均成绩:2.4128分,总体:579人\n",
"balance平均成绩:2.082分,男性:244人\n",
"balance平均成绩:1.9628分,女性:296人\n",
"balance平均成绩:2.0167分,总体:540人\n",
"reaction平均成绩:1.9648分,男性:256人\n",
"reaction平均成绩:1.7453分,女性:318人\n",
"reaction平均成绩:1.8432分,总体:574人\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"list1 = []\n",
"\n",
"wb = openpyxl.load_workbook('data/杨庙测试2023年8月报告明细表.xlsx')\n",
"sheet = wb.active\n",
"items = ['bmi','lung','grip','flexion','balance','reaction']\n",
"dict1 = {}\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value) \n",
" list1.append(str(code)) \n",
"filename = 'data/result_杨庙2308.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
" \n",
"for item in items: \n",
" m = 0\n",
" f = 0\n",
" score = 0\n",
" t_score = 0\n",
" for k,v in dict1.items():\n",
" if v['gender'] == 'male' and item in v['fit'].keys() and k in list1:\n",
" #print(k)\n",
" \n",
" if v['fit'][item]['score']!=\"\":\n",
" m = m +1\n",
" score = score+int(v['fit'][item]['score'])\n",
" if m>0:\n",
" print(f'{item}平均成绩:{round(score/m,4)}分,男性:{m}人')\n",
" t_score = t_score + score\n",
" score = 0\n",
" for k,v in dict1.items():\n",
" if v['gender'] == 'female' and item in v['fit'].keys() and k in list1:\n",
" \n",
" if v['fit'][item]['score']!=\"\":\n",
" f = f +1\n",
" score = score+int(v['fit'][item]['score'])\n",
" if f >0:\n",
" print(f'{item}平均成绩:{round(score/f,4)}分,女性:{f}人')\n",
" t_score = t_score + score\n",
" if (f+m)>0:\n",
" print(f'{item}平均成绩:{round(t_score/(f+m),4)}分,总体:{f+m}人')"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "775e5a8b-6384-4d67-bbda-c5655dba05d3",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-10T11:34:53.146506Z",
"iopub.status.busy": "2023-10-10T11:34:53.146035Z",
"iopub.status.idle": "2023-10-10T11:34:53.228193Z",
"shell.execute_reply": "2023-10-10T11:34:53.227372Z",
"shell.execute_reply.started": "2023-10-10T11:34:53.146468Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"579\n",
"男性:260人\n",
"女性:319人\n",
"总体:579人\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"list1 = []\n",
"\n",
"wb = openpyxl.load_workbook('data/杨庙测试2023年8月报告明细表.xlsx')\n",
"sheet = wb.active\n",
"items = ['bmi','lung','grip','flexion','balance','reaction']\n",
"\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value) \n",
" list1.append(str(code)) \n",
"\n",
"\n",
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/杨庙社区人员信息2307.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"print(len(list1))\n",
"\n",
"m =0\n",
"f =0\n",
"for k,v in dict1.items():\n",
" if v['sex'] == '男' and k in list1:\n",
" m = m +1\n",
"print(f'男性:{m}人')\n",
"\n",
"for k,v in dict1.items():\n",
" if v['sex'] == '女' and k in list1:\n",
" f = f +1\n",
"print(f'女性:{f}人')\n",
"\n",
"print(f'总体:{f+m}人')"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "33984dce-b540-4f60-a100-6399f43d9df8",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-10T11:33:29.904700Z",
"iopub.status.busy": "2023-10-10T11:33:29.904220Z",
"iopub.status.idle": "2023-10-10T11:33:29.960744Z",
"shell.execute_reply": "2023-10-10T11:33:29.960314Z",
"shell.execute_reply.started": "2023-10-10T11:33:29.904662Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"list1 = []\n",
"\n",
"wb = openpyxl.load_workbook('data/杨庙测试2023年8月报告明细表.xlsx')\n",
"sheet = wb.active\n",
"items = ['bmi','lung','grip','flexion','balance','reaction']\n",
"dict1 = {}\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value) \n",
" list1.append(str(code)) \n",
"\n",
"\n",
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_杨庙2308.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"for item in list1:\n",
" if item not in dict1.keys():\n",
" print(item)"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "a74b5034-9613-49ca-ba65-c82a443b143b",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-10T11:34:15.953655Z",
"iopub.status.busy": "2023-10-10T11:34:15.953183Z",
"iopub.status.idle": "2023-10-10T11:34:16.028478Z",
"shell.execute_reply": "2023-10-10T11:34:16.028017Z",
"shell.execute_reply.started": "2023-10-10T11:34:15.953618Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"list1 = []\n",
"\n",
"wb = openpyxl.load_workbook('data/杨庙测试2023年8月报告明细表.xlsx')\n",
"sheet = wb.active\n",
"items = ['bmi','lung','grip','flexion','balance','reaction']\n",
"dict1 = {}\n",
"for n in range(2, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value) \n",
" if str(code) not in list1:\n",
" list1.append(str(code))\n",
" else:\n",
" print(code)\n",
"\n",
"\n",
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_杨庙2308.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"for item in list1:\n",
" if item not in dict1.keys():\n",
" print(item)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "22e1e0cf-5620-47d4-8034-03149fcd0b00",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {