20230427
This commit is contained in:
1 parent
d5af3bcb91
commit
f03e964585
3 files changed
+475
-68
No files matched your search
+88
-27
@@ -53,8 +53,6 @@
|
||||
" sex = '女'\n",
|
||||
" dict1['sex'] = sex\n",
|
||||
" dict1['unit'] = sheet.cell(n, 3).value\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/石家庄2023.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
@@ -72,15 +70,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"execution_count": 36,
|
||||
"id": "dd3c65ea-cc8a-4f1b-8698-d1799f99e101",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-26T09:36:18.999273Z",
|
||||
"iopub.status.busy": "2023-04-26T09:36:18.998427Z",
|
||||
"iopub.status.idle": "2023-04-26T09:36:19.081109Z",
|
||||
"shell.execute_reply": "2023-04-26T09:36:19.080378Z",
|
||||
"shell.execute_reply.started": "2023-04-26T09:36:18.999232Z"
|
||||
"iopub.execute_input": "2023-04-27T07:07:34.179338Z",
|
||||
"iopub.status.busy": "2023-04-27T07:07:34.178517Z",
|
||||
"iopub.status.idle": "2023-04-27T07:07:34.222956Z",
|
||||
"shell.execute_reply": "2023-04-27T07:07:34.221926Z",
|
||||
"shell.execute_reply.started": "2023-04-27T07:07:34.179297Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -89,7 +87,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"454\n",
|
||||
"118\n",
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
@@ -113,7 +111,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20230426-sjz.csv'\n",
|
||||
"filename = 'data/places_result_20230427-sjz.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -135,7 +133,7 @@
|
||||
" score = int(result[4])/item[m_item]['divisor'] \n",
|
||||
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
|
||||
"print(len(re_ta))\n",
|
||||
"filename = 'data/result_石家庄(20230426).json'\n",
|
||||
"filename = 'data/result_石家庄(20230427).json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl) \n",
|
||||
"print('ok')"
|
||||
@@ -151,15 +149,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"execution_count": 37,
|
||||
"id": "97d86ce2-6664-41a1-89d2-ddaa0611bac1",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-26T09:37:10.787453Z",
|
||||
"iopub.status.busy": "2023-04-26T09:37:10.786596Z",
|
||||
"iopub.status.idle": "2023-04-26T09:37:10.924736Z",
|
||||
"shell.execute_reply": "2023-04-26T09:37:10.923992Z",
|
||||
"shell.execute_reply.started": "2023-04-26T09:37:10.787410Z"
|
||||
"iopub.execute_input": "2023-04-27T07:07:54.855417Z",
|
||||
"iopub.status.busy": "2023-04-27T07:07:54.854561Z",
|
||||
"iopub.status.idle": "2023-04-27T07:07:54.933949Z",
|
||||
"shell.execute_reply": "2023-04-27T07:07:54.932922Z",
|
||||
"shell.execute_reply.started": "2023-04-27T07:07:54.855376Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -170,7 +168,7 @@
|
||||
"\n",
|
||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"filename = 'data/result_石家庄(20230426).json'\n",
|
||||
"filename = 'data/result_石家庄(20230427).json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
@@ -194,7 +192,7 @@
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/石家庄石化体测情况表(20230426).xlsx'\n",
|
||||
"filename = 'data/石家庄石化体测情况表(20230427).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -214,15 +212,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"execution_count": 38,
|
||||
"id": "e2b68cb1-3a6f-4b51-afbd-d6c9634348b1",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-26T09:38:27.401785Z",
|
||||
"iopub.status.busy": "2023-04-26T09:38:27.401110Z",
|
||||
"iopub.status.idle": "2023-04-26T09:38:27.597084Z",
|
||||
"shell.execute_reply": "2023-04-26T09:38:27.596368Z",
|
||||
"shell.execute_reply.started": "2023-04-26T09:38:27.401745Z"
|
||||
"iopub.execute_input": "2023-04-27T07:10:23.308568Z",
|
||||
"iopub.status.busy": "2023-04-27T07:10:23.307717Z",
|
||||
"iopub.status.idle": "2023-04-27T07:10:23.593399Z",
|
||||
"shell.execute_reply": "2023-04-27T07:10:23.592690Z",
|
||||
"shell.execute_reply.started": "2023-04-27T07:10:23.308525Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -231,7 +229,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"2140\n",
|
||||
"2254\n",
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
@@ -255,7 +253,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20230426-sjzall.csv'\n",
|
||||
"filename = 'data/places_result_20230427-sjz-all.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -283,6 +281,69 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6adeedfe-999a-47c2-aeed-fb4467b27026",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 39,
|
||||
"id": "29ed0a03-72e1-4bee-8d00-95555f129d93",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-04-27T07:11:19.132911Z",
|
||||
"iopub.status.busy": "2023-04-27T07:11:19.132425Z",
|
||||
"iopub.status.idle": "2023-04-27T07:11:19.660183Z",
|
||||
"shell.execute_reply": "2023-04-27T07:11:19.659444Z",
|
||||
"shell.execute_reply.started": "2023-04-27T07:11:19.132880Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"filename = 'data/result_石家庄.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/石家庄2023.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
" \n",
|
||||
"list1 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(str(k).rjust(5,'0'))\n",
|
||||
" list2.append(v['name']) \n",
|
||||
" list2.append(dict2[k]['sex'])\n",
|
||||
" list2.append(dict2[k]['unit']) \n",
|
||||
" \n",
|
||||
" for item in items:\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",
|
||||
" 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)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "e5de157c-18e2-4a6a-bae8-3db88822b88f",
|
||||
|
||||
Reference in new issue
Block a user