This commit is contained in:
512song committed 2024-08-04 00:13:12 +08:00
1 parent ae270581b1
commit 11a1e51802
5 files changed
+3130 -3048

No files matched your search

+53 -1
View File
@@ -1631,8 +1631,60 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 113,
"id": "5aefec37-8db4-49c0-bb73-56906f3510ec",
"metadata": {
"execution": {
"iopub.execute_input": "2024-07-25T15:31:51.204580Z",
"iopub.status.busy": "2024-07-25T15:31:51.203825Z",
"iopub.status.idle": "2024-07-25T15:31:51.226327Z",
"shell.execute_reply": "2024-07-25T15:31:51.225747Z",
"shell.execute_reply.started": "2024-07-25T15:31:51.204509Z"
}
},
"outputs": [],
"source": [
"import openpyxl\n",
"\n",
"filename = 'data/result_青海all_2.json'\n",
"list4 = ['颈椎','胸椎','腰椎','骶尾椎']\n",
"list5 = [[0,10,10],[10,17,7],[17,24,6],[24,26,2]]\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"data_list = []\n",
"for k, v in dict1.items():\n",
" \n",
" if 'spine' in v.keys():\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",
" 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",
" for item in spine:\n",
" list6.append(item)\n",
" data_list.append(list6)\n",
" \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) "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "df0dc1d9-ad92-44b5-9214-14d433a877f1",
"metadata": {},
"outputs": [],
"source": []