This commit is contained in:
512song committed 2024-07-25 21:53:21 +08:00
1 parent 679c9514ea
commit ae270581b1
5 files changed
+3670 -744

No files matched your search

+415 -356
View File
@@ -1,5 +1,13 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "511a2aee-e09b-475a-a201-f6e1c72e053b",
"metadata": {},
"source": [
"# 体测数据处理"
]
},
{
"cell_type": "markdown",
"id": "04524c85-988e-4dbf-86eb-939a9db7aa28",
@@ -10,27 +18,12 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-15T10:15:07.803553Z",
"iopub.status.busy": "2024-05-15T10:15:07.803255Z",
"iopub.status.idle": "2024-05-15T10:15:07.958318Z",
"shell.execute_reply": "2024-05-15T10:15:07.957863Z",
"shell.execute_reply.started": "2024-05-15T10:15:07.803529Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -59,27 +52,12 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "482517fc-650c-4b8c-bdf3-b32ec508de99",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T09:32:43.937514Z",
"iopub.status.busy": "2024-06-12T09:32:43.936781Z",
"iopub.status.idle": "2024-06-12T09:32:43.965201Z",
"shell.execute_reply": "2024-06-12T09:32:43.964613Z",
"shell.execute_reply.started": "2024-06-12T09:32:43.937449Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -116,27 +94,12 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-06T04:07:25.580543Z",
"iopub.status.busy": "2023-12-06T04:07:25.580096Z",
"iopub.status.idle": "2023-12-06T04:07:25.602275Z",
"shell.execute_reply": "2023-12-06T04:07:25.599401Z",
"shell.execute_reply.started": "2023-12-06T04:07:25.580484Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -169,28 +132,12 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": null,
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-15T13:07:30.547209Z",
"iopub.status.busy": "2024-05-15T13:07:30.546727Z",
"iopub.status.idle": "2024-05-15T13:07:30.568057Z",
"shell.execute_reply": "2024-05-15T13:07:30.566736Z",
"shell.execute_reply.started": "2024-05-15T13:07:30.547158Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"27\n",
"27\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -248,28 +195,12 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": null,
"id": "724306c7-6b00-4322-856b-28ec96dfe9d0",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-15T13:07:38.825400Z",
"iopub.status.busy": "2024-05-15T13:07:38.824940Z",
"iopub.status.idle": "2024-05-15T13:07:38.851607Z",
"shell.execute_reply": "2024-05-15T13:07:38.851206Z",
"shell.execute_reply.started": "2024-05-15T13:07:38.825363Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"27\n",
"27\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import datetime\n",
@@ -361,27 +292,12 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": null,
"id": "a9228dc5-e3b1-4a48-8938-747abb59786c",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-15T13:07:46.464810Z",
"iopub.status.busy": "2024-05-15T13:07:46.464338Z",
"iopub.status.idle": "2024-05-15T13:07:46.499865Z",
"shell.execute_reply": "2024-05-15T13:07:46.498876Z",
"shell.execute_reply.started": "2024-05-15T13:07:46.464771Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -516,16 +432,9 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-15T10:36:24.371302Z",
"iopub.status.busy": "2024-05-15T10:36:24.370831Z",
"iopub.status.idle": "2024-05-15T10:36:24.404481Z",
"shell.execute_reply": "2024-05-15T10:36:24.402924Z",
"shell.execute_reply.started": "2024-05-15T10:36:24.371263Z"
},
"tags": []
},
"outputs": [],
@@ -580,30 +489,12 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "67e63f07-3f20-4e0e-9c07-7bf6024eeb4b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T09:33:33.449532Z",
"iopub.status.busy": "2024-06-12T09:33:33.448794Z",
"iopub.status.idle": "2024-06-12T09:33:33.470858Z",
"shell.execute_reply": "2024-06-12T09:33:33.470068Z",
"shell.execute_reply.started": "2024-06-12T09:33:33.449463Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"18993710898\n",
"18894239366\n",
"13801023617\n",
"19009775378\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -708,27 +599,12 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "9e96d70b-3f7c-4c55-8c7a-f8373c2d9a7a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T09:36:27.538771Z",
"iopub.status.busy": "2024-06-12T09:36:27.538043Z",
"iopub.status.idle": "2024-06-12T09:36:46.165927Z",
"shell.execute_reply": "2024-06-12T09:36:46.164846Z",
"shell.execute_reply.started": "2024-06-12T09:36:27.538707Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"35\n"
]
}
],
"outputs": [],
"source": [
"import requests\n",
"import json\n",
@@ -801,29 +677,12 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "11727a08-9da8-4eb2-aadf-69dc72031bdc",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-20T06:45:31.065931Z",
"iopub.status.busy": "2024-05-20T06:45:31.065241Z",
"iopub.status.idle": "2024-05-20T06:45:31.078036Z",
"shell.execute_reply": "2024-05-20T06:45:31.077063Z",
"shell.execute_reply.started": "2024-05-20T06:45:31.065872Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"27\n",
"14\n",
"11\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -864,40 +723,10 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "f93523ed-a9fb-46f4-8f38-17ebde168303",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-03T05:27:38.006019Z",
"iopub.status.busy": "2024-06-03T05:27:38.005067Z",
"iopub.status.idle": "2024-06-03T05:27:38.015980Z",
"shell.execute_reply": "2024-06-03T05:27:38.014890Z",
"shell.execute_reply.started": "2024-06-03T05:27:38.005949Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['18993727823', '18909376562', '18993710970', '18997374506', '18997372109', '18093715987', '18997372608', '18993722556', '18993710998', '18993729661', '18993710973', '18993714097', '18909376963', '18993728737']\n",
"20\n",
"18\n",
"42\n",
"44\n",
"61\n",
"62\n",
"24\n",
"68\n",
"9\n",
"3\n",
"55\n",
"33\n",
"5\n",
"50\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -937,17 +766,9 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "953e6f09-74dd-48cf-810e-ffe78f621c81",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-03T08:53:03.990417Z",
"iopub.status.busy": "2024-06-03T08:53:03.989701Z",
"iopub.status.idle": "2024-06-03T08:53:04.015802Z",
"shell.execute_reply": "2024-06-03T08:53:04.014751Z",
"shell.execute_reply.started": "2024-06-03T08:53:03.990354Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import json\n",
@@ -982,26 +803,10 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"id": "3cc922d2-9a1f-4aa6-8011-5541fe2e9715",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T10:09:49.493466Z",
"iopub.status.busy": "2024-06-12T10:09:49.492704Z",
"iopub.status.idle": "2024-06-12T10:09:49.504610Z",
"shell.execute_reply": "2024-06-12T10:09:49.503561Z",
"shell.execute_reply.started": "2024-06-12T10:09:49.493398Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -1024,27 +829,10 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"id": "804f1cf0-c2e6-4c4d-841b-1cc5e25c35f7",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T10:11:46.968562Z",
"iopub.status.busy": "2024-06-12T10:11:46.967823Z",
"iopub.status.idle": "2024-06-12T10:11:46.982324Z",
"shell.execute_reply": "2024-06-12T10:11:46.981223Z",
"shell.execute_reply.started": "2024-06-12T10:11:46.968493Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"14\n",
"14\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -1094,27 +882,10 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"id": "0faf3ee7-e075-42bd-84ca-aea2b4ee890e",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T10:13:41.889274Z",
"iopub.status.busy": "2024-06-12T10:13:41.887953Z",
"iopub.status.idle": "2024-06-12T10:13:41.903763Z",
"shell.execute_reply": "2024-06-12T10:13:41.903073Z",
"shell.execute_reply.started": "2024-06-12T10:13:41.889194Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"14\n",
"14\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import datetime\n",
@@ -1198,26 +969,10 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"id": "62863430-1d61-4282-b500-7261c66ec176",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T10:15:13.832706Z",
"iopub.status.busy": "2024-06-12T10:15:13.831999Z",
"iopub.status.idle": "2024-06-12T10:15:13.851428Z",
"shell.execute_reply": "2024-06-12T10:15:13.850214Z",
"shell.execute_reply.started": "2024-06-12T10:15:13.832645Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -1344,54 +1099,10 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"id": "35c83ea5-e331-4655-aba5-42720e2bc63a",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T10:16:48.636396Z",
"iopub.status.busy": "2024-06-12T10:16:48.635668Z",
"iopub.status.idle": "2024-06-12T10:16:48.657437Z",
"shell.execute_reply": "2024-06-12T10:16:48.656829Z",
"shell.execute_reply.started": "2024-06-12T10:16:48.636335Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"18993727823\n",
"18909376562\n",
"18993710970\n",
"18997374506\n",
"18997372109\n",
"18093715987\n",
"18997372608\n",
"18993722556\n",
"18894239366\n",
"18993710998\n",
"13801023617\n",
"18993710998\n",
"18993729661\n",
"18093715391\n",
"18993710973\n",
"18997372109\n",
"18993714097\n",
"18909376963\n",
"18993728737\n",
"18997372608\n",
"18909376562\n",
"18993729661\n",
"18993712026\n",
"18993710395\n",
"18997375563\n",
"18993712869\n",
"18993710955\n",
"19009775378\n",
"18997375312\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
@@ -1488,26 +1199,10 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"id": "1f137b9b-b51b-4a7a-baea-b1978e5f00c1",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T10:18:43.533220Z",
"iopub.status.busy": "2024-06-12T10:18:43.532466Z",
"iopub.status.idle": "2024-06-12T10:18:51.206996Z",
"shell.execute_reply": "2024-06-12T10:18:51.205814Z",
"shell.execute_reply.started": "2024-06-12T10:18:43.533131Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"14\n"
]
}
],
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import json\n",
@@ -1570,10 +1265,374 @@
"print(i)"
]
},
{
"cell_type": "markdown",
"id": "1208eb16-a220-48c4-8c9e-cc4dbf67306e",
"metadata": {},
"source": [
"# 体测数据分析"
]
},
{
"cell_type": "markdown",
"id": "edec8124-5432-4248-964e-69e1ed425782",
"metadata": {},
"source": [
"## 常用参数及自定义函数"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "56dfb00b-d907-4d0a-8a12-f39e9db6f6a2",
"id": "523523ed-340a-4d0e-bd7a-d0b09b36ab13",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"questions = [\n",
" [1],\n",
" [-1, 2],\n",
" [-1, 2],\n",
" [-1, 8],\n",
" [-1, 3],\n",
" [1],\n",
" [-1],\n",
" [-1, 7],\n",
" [2],\n",
" [2],\n",
" [2],\n",
" [2, 3],\n",
" [2],\n",
" [2],\n",
" [3],\n",
" [3],\n",
" [3],\n",
" [3],\n",
" [3],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [4],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [5],\n",
" [6],\n",
" [6],\n",
" [6],\n",
" [6],\n",
" [6],\n",
" [6],\n",
" [7],\n",
" [7],\n",
" [7],\n",
" [7],\n",
" [7],\n",
" [7],\n",
" [8],\n",
" [8],\n",
" [8],\n",
" [8],\n",
" [8],\n",
" [8],\n",
" [9],\n",
" [9],\n",
" [9],\n",
" [9],\n",
" [9],\n",
" [9],\n",
" [9]\n",
"]\n",
"\n",
"kinds = [\n",
" '平和',\n",
" '气虚',\n",
" '阳虚',\n",
" '阴虚',\n",
" '痰湿',\n",
" '湿热',\n",
" '血瘀',\n",
" '气郁',\n",
" '特禀'\n",
"]\n",
"\n",
"def tcm_calc(arr):\n",
" qa = [8, 8, 7, 8, 8, 6, 7, 7, 7]\n",
" # 成绩数组\n",
" s = [0] * 9\n",
" # 遍历五进制\n",
" for i in range(len(questions)):\n",
" m = arr[i] - 1\n",
" for v in questions[i]:\n",
" if v < 0:\n",
" s[-v - 1] += 4 - m\n",
" else:\n",
" s[v - 1] += m\n",
" return [int((v / qa[i]) * 25) for i, v in enumerate(s)]\n",
"\n",
"def tcm_kind(score):\n",
" kind = 0\n",
" near = False\n",
" max_kind = 0\n",
" max_score = 0\n",
" for i in range(1, 9):\n",
" if score[i] > max_score:\n",
" max_kind = i\n",
" max_score = score[i]\n",
" if score[0] >= 60 and max_score < 40:\n",
" if max_score >= 30:\n",
" near = True\n",
" kind = max_kind\n",
" else:\n",
" kind = max_kind\n",
" return {\n",
" \"kind\": kind,\n",
" \"near\": near\n",
" }\n",
"list2 = ['成就感','愉快心境','放松程度','压力应对','体力充沛','情感充沛度']\n",
"list3 = [[5,7],[7,4],[7,4],[7,4],[8,1],[6,1]] \n",
"list4 = ['颈椎','胸椎','腰椎','骶尾椎']\n",
"list5 = [[0,10,10],[10,17,7],[17,24,6],[24,26,2]]"
]
},
{
"cell_type": "markdown",
"id": "4eda4ded-9be7-4a64-af16-5b6e4942b540",
"metadata": {},
"source": [
"## 计算中医体质"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3ab82376-e416-4411-a017-0463a9b8c10a",
"metadata": {},
"outputs": [],
"source": [
"\n",
"filename = 'data/result_青海all_2.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"for k, v in dict1.items():\n",
" if 'tcm' in v.keys():\n",
" list1 = []\n",
" tcm =v['tcm']\n",
" for item in tcm:\n",
" list1.append(item)\n",
" score = tcm_calc(list1)\n",
"\n",
" result = tcm_kind(score)\n",
" kind = result['kind']\n",
" near = result['near']\n",
" print(k,kinds[kind], near, score)"
]
},
{
"cell_type": "markdown",
"id": "35adcab6-e388-4abd-beba-b8bbc07b157e",
"metadata": {},
"source": [
"## 计算心理"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ffce959e-d42b-40eb-b694-d47cc7a73124",
"metadata": {},
"outputs": [],
"source": [
"list2 = ['成就感','愉快心境','放松程度','压力应对','体力充沛','情感充沛度']\n",
"list3 = [[5,7],[7,4],[7,4],[7,4],[8,1],[6,1]]\n",
"qb = [\n",
" 1, 1, 1, 1, 1,\n",
" 4, 3, 2, 3, 2, 4, 3,\n",
" 4, 3, 2, 4, 4, 2, 4,\n",
" 3, 2, 2, 4, 3, 3, 2,\n",
" 5, 5, 5, 5, 5, 5, 5, 5,\n",
" 6, 6, 6, 6, 6, 6\n",
" ]\n",
"filename = 'data/result_青海all_2.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"for k, v in dict1.items():\n",
" if 'psy' in v.keys():\n",
" psy=v['psy']\n",
" for i in range(26,40):\n",
" new_valve = psy[i]-1\n",
" psy[i] = new_valve\n",
" dict3 = {}\n",
" \n",
" i = 0\n",
" for item in qb:\n",
" dict3.setdefault(item,0)\n",
" dict3[item] +=psy[i]\n",
" i+=1\n",
" print(dict3)\n",
" print(k)\n",
" for i in range(0,6):\n",
" score = int(dict3[i+1]/list3[i][0]/list3[i][1]*100)\n",
" print(list2[i],score)"
]
},
{
"cell_type": "markdown",
"id": "74f5837d-c6ea-4be7-bfca-eeb720d63436",
"metadata": {},
"source": [
"## 计算脊柱"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "67c19da3-5e06-480b-94a4-76659517d3c3",
"metadata": {},
"outputs": [],
"source": [
"list4 = ['颈椎','胸椎','腰椎','骶尾椎']\n",
"list5 = [[0,10,10],[10,17,7],[17,24,6],[24,26,2]]\n",
"filename = 'data/result_青海all_2.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"for k, v in dict1.items():\n",
" if 'spine' in v.keys():\n",
" spine = v['spine']\n",
" for i in range(0,4):\n",
" score = 0\n",
" for ii in range(list5[i][0],list5[i][1]):\n",
" score+= spine[ii]\n",
" print(k,list4[i],int(score/list5[i][2]*100)-100)"
]
},
{
"cell_type": "code",
"execution_count": 108,
"id": "40ff33f6-5fd3-423e-bf52-ac16327e8f82",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-25T12:47:36.317570Z",
"iopub.status.busy": "2024-07-25T12:47:36.316733Z",
"iopub.status.idle": "2024-07-25T12:47:36.348711Z",
"shell.execute_reply": "2024-07-25T12:47:36.348235Z",
"shell.execute_reply.started": "2024-07-25T12:47:36.317491Z"
}
},
"outputs": [],
"source": [
"import openpyxl\n",
"\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
"filename = 'data/result_青海all_2.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"data_list = []\n",
"for k, v in dict1.items():\n",
" list6 = []\n",
" list6.append(str(k).rjust(4,'0'))\n",
" list6.append(v['name'])\n",
" list6.append(v['sex'])\n",
" list6.append(v['unit'])\n",
" list6.append(v['age'])\n",
" if 'bmi' in v.keys():\n",
" bmi = v['bmi']['成绩']\n",
" list6.append(bmi.split(',')[0]+' 厘米')\n",
" list6.append(bmi.split(',')[1]+' 千克')\n",
" list6.append(v['bmi']['score'])\n",
" else:\n",
" list6.append('')\n",
" list6.append('')\n",
" list6.append('')\n",
" for xm in list_item:\n",
" if xm in v.keys():\n",
" list6.append(v[xm]['成绩'])\n",
" list6.append(v[xm]['score'])\n",
" else:\n",
" list6.append('')\n",
" list6.append('')\n",
" \n",
" if 'tcm' in v.keys():\n",
" list1 = []\n",
" tcm =v['tcm']\n",
" for item in tcm:\n",
" list1.append(item)\n",
" score = tcm_calc(list1)\n",
"\n",
" result = tcm_kind(score)\n",
" kind = result['kind']\n",
" near = result['near']\n",
" #print(k,kinds[kind], near, score)\n",
" list6.append(kinds[kind])\n",
" if near:\n",
" list6.append('是')\n",
" else:\n",
" list6.append('')\n",
" for item in score:\n",
" list6.append(item)\n",
" else:\n",
" for i in range(0,11):\n",
" list6.append('')\n",
" i+=1\n",
" if 'psy' in v.keys():\n",
" psy=v['psy']\n",
" for i in range(26,40):\n",
" new_valve = psy[i]-1\n",
" psy[i] = new_valve\n",
" dict3 = {}\n",
" \n",
" i = 0\n",
" for item in qb:\n",
" dict3.setdefault(item,0)\n",
" dict3[item] +=psy[i]\n",
" i+=1\n",
" \n",
" for i in range(0,6):\n",
" score = int(dict3[i+1]/list3[i][0]/list3[i][1]*100)\n",
" list6.append(score)\n",
" else:\n",
" for i in range(0,6):\n",
" list6.append('')\n",
" i+=1\n",
" if 'spine' in v.keys():\n",
" spine = v['spine']\n",
" for i in range(0,4):\n",
" score = 0\n",
" for ii in range(list5[i][0],list5[i][1]):\n",
" score+= spine[ii]\n",
" list6.append(int(score/list5[i][2]*100)-100)\n",
" else:\n",
" for i in range(0,4):\n",
" list6.append('')\n",
" i+=1\n",
" data_list.append(list6)\n",
"filename = 'data/青海测试情况表.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"#sheet.append(title)\n",
"for row in data_list:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename) \n",
" \n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5aefec37-8db4-49c0-bb73-56906f3510ec",
"metadata": {},
"outputs": [],
"source": []