This commit is contained in:
512song committed 2022-09-21 07:28:25 +08:00
1 parent cf24b2f917
commit ff41c298f7
1 file changed
+91 -4
+91 -4
View File
@@ -971,12 +971,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 20,
"id": "93d73139-1734-49e5-a59a-15898af9b1d8",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-20T15:35:38.432469Z",
"iopub.status.busy": "2022-09-20T15:35:38.431154Z",
"iopub.status.idle": "2022-09-20T15:35:39.124591Z",
"shell.execute_reply": "2022-09-20T15:35:39.120784Z",
"shell.execute_reply.started": "2022-09-20T15:35:38.432357Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import pymysql\n",
"import json\n",
@@ -997,7 +1012,7 @@
"dict1 = {}\n",
"list1 = []\n",
"#print(\"\\n运动项目信息:\")\n",
"filename = 'data/135.csv'\n",
"filename = 'data/136_220914.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -1016,7 +1031,7 @@
" score = int(result[1])/item[m_item]['divisor'] \n",
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
" re_ta[user][item_name]['得分'] =result[2]\n",
"filename = 'data/result_135.json'\n",
"filename = 'data/result_2209.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl) \n",
"print('ok')\n",
@@ -1120,6 +1135,78 @@
" "
]
},
{
"cell_type": "markdown",
"id": "75affb71-e222-4002-83a5-6ff75258bf74",
"metadata": {},
"source": [
"## 比照人员两年成绩"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "9e29dc46-9c2c-48b9-9847-4e9b535f99ac",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-20T23:15:17.498487Z",
"iopub.status.busy": "2022-09-20T23:15:17.497278Z",
"iopub.status.idle": "2022-09-20T23:15:21.393538Z",
"shell.execute_reply": "2022-09-20T23:15:21.390926Z",
"shell.execute_reply.started": "2022-09-20T23:15:17.498383Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"filename = 'data/安庆2021.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"list1 = dict1.keys()\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_2209.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"list4 = []\n",
"for k, v in dict2.items():\n",
" if k in list1:\n",
" #print(k)\n",
" list2 = [k,v['name'],v['unit']]\n",
" list3 = []\n",
" for item in items:\n",
" # 获取2022年成绩\n",
" if item in v.keys():\n",
" list2.append(v[item]['成绩']) \n",
" #elif item =='name':\n",
" # list2.append(v[item])\n",
" else:\n",
" list2.append('')\n",
" if item in dict1[k].keys():\n",
" list3.append(dict1[k][item]['成绩']) \n",
" #elif item =='name':\n",
" # list2.append(v[item])\n",
" else:\n",
" list3.append('')\n",
" for cj in list3:\n",
" list2.append(cj) \n",
" list4.append(list2)\n",
"filename = 'data/安庆石化成绩对照2209.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
"for row in list4:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename) \n",
" \n",
" "
]
},
{
"cell_type": "markdown",
"id": "2c1c84a7-2ca3-4d1a-ba9c-11c813875d7c",