20221116
This commit is contained in:
1 parent
d8a85055f9
commit
7b945a2104
1 file changed
+101
-5
+101
-5
@@ -53,12 +53,27 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 5,
|
||||
"id": "a57ebb22-543c-4804-8d44-89984058ec1d",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-11-16T09:35:45.541035Z",
|
||||
"iopub.status.busy": "2022-11-16T09:35:45.540728Z",
|
||||
"iopub.status.idle": "2022-11-16T09:35:45.957785Z",
|
||||
"shell.execute_reply": "2022-11-16T09:35:45.957196Z",
|
||||
"shell.execute_reply.started": "2022-11-16T09:35:45.541009Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
@@ -113,9 +128,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 7,
|
||||
"id": "38397ad4-2bb3-4b5e-8ece-9ea11e801890",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-11-16T09:41:28.683867Z",
|
||||
"iopub.status.busy": "2022-11-16T09:41:28.683511Z",
|
||||
"iopub.status.idle": "2022-11-16T09:41:29.562767Z",
|
||||
"shell.execute_reply": "2022-11-16T09:41:29.562057Z",
|
||||
"shell.execute_reply.started": "2022-11-16T09:41:28.683845Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -141,7 +163,7 @@
|
||||
" list2.append(dict2[k]['sex'])\n",
|
||||
" list2.append(dict2[k]['unit'])\n",
|
||||
" list2.append(dict2[k]['sub_unit'])\n",
|
||||
" \n",
|
||||
" if len(v.keys())>5:\n",
|
||||
" for item in items:\n",
|
||||
" if item in v.keys():\n",
|
||||
" list2.append(v[item]['成绩'])\n",
|
||||
@@ -152,7 +174,7 @@
|
||||
" list2.append('') \n",
|
||||
"\n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/天津石化体测情况表(截至20221110).xlsx'\n",
|
||||
"filename = 'data/天津石化体测情况表(20221116).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -162,6 +184,80 @@
|
||||
"wb.save(filename)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "07461b64-e57e-4b39-b010-b451c0da0e07",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导出测试成绩(带得分)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "0c95d716-11ab-4f6e-ab43-b72394946ded",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-11-16T09:36:27.473683Z",
|
||||
"iopub.status.busy": "2022-11-16T09:36:27.473373Z",
|
||||
"iopub.status.idle": "2022-11-16T09:36:28.925329Z",
|
||||
"shell.execute_reply": "2022-11-16T09:36:28.924695Z",
|
||||
"shell.execute_reply.started": "2022-11-16T09:36:27.473656Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"title = ['编号','姓名','性别','单位/部门','车间/科室','身高','','体重','','肺活量','','握力','','坐位体前屈','','纵跳','','俯卧撑','','一分钟仰卧起坐','','单脚站立','','选择反应时','','台阶指数']\n",
|
||||
"filename = 'data/result_天津.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl)\n",
|
||||
"filename = 'data/天津石化人员名单.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"\n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" #print(k,dict2[str(k)]['name'])\n",
|
||||
" list2 = []\n",
|
||||
" list2.append(str(k).rjust(5,'0'))\n",
|
||||
" list2.append(v['name']) \n",
|
||||
" list2.append(dict1[k]['sex'])\n",
|
||||
" list2.append(dict1[k]['unit']) \n",
|
||||
" list2.append(dict2[k]['sub_unit'])\n",
|
||||
" if len(v.keys())>5: \n",
|
||||
" for item in items:\n",
|
||||
" if item in v.keys():\n",
|
||||
" list2.append(v[item]['成绩'])\n",
|
||||
" list2.append(v[item]['得分']) \n",
|
||||
" elif item =='name':\n",
|
||||
" list2.append(v[item])\n",
|
||||
" else:\n",
|
||||
" list2.append('') \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)\n",
|
||||
"print('ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1c7b219f-43cd-4bf0-971f-2c398f8db8ed",
|
||||
|
||||
Reference in new issue
Block a user