20251117
This commit is contained in:
1 parent
48f119d087
commit
31ddcb887f
9 files changed
+1089
-276
No files matched your search
+216
-70
@@ -10,15 +10,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": 8,
|
||||
"id": "270e8c57-36d3-476c-8c50-4d8bc38a918a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-13T08:43:12.873509Z",
|
||||
"iopub.status.busy": "2025-11-13T08:43:12.873249Z",
|
||||
"iopub.status.idle": "2025-11-13T08:43:13.076138Z",
|
||||
"shell.execute_reply": "2025-11-13T08:43:13.075593Z",
|
||||
"shell.execute_reply.started": "2025-11-13T08:43:12.873486Z"
|
||||
"iopub.execute_input": "2025-11-17T01:38:45.210547Z",
|
||||
"iopub.status.busy": "2025-11-17T01:38:45.209877Z",
|
||||
"iopub.status.idle": "2025-11-17T01:38:45.422897Z",
|
||||
"shell.execute_reply": "2025-11-17T01:38:45.422462Z",
|
||||
"shell.execute_reply.started": "2025-11-17T01:38:45.210491Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -26,7 +26,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1301 ok\n"
|
||||
"1295 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -41,8 +41,8 @@
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = sheet.cell(n, 2).value\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" code = int(sheet.cell(n, 2).value)\n",
|
||||
" person.setdefault(str(code), {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 4).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 5).value\n",
|
||||
@@ -50,7 +50,7 @@
|
||||
" dict1['unit'] = sheet.cell(n, 3).value\n",
|
||||
" if sheet.cell(n, 7).value is not None:\n",
|
||||
" dict1['phone'] = str(sheet.cell(n, 7).value)\n",
|
||||
" person[code] = dict1\n",
|
||||
" person[str(code)] = dict1\n",
|
||||
"filename = 'data/沧州炼化人员.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
@@ -59,15 +59,48 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"id": "6c5f1858-e01e-4cf0-85b1-2019a37c3b37",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/沧州炼化人员.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = sheet.cell(n, 2).value\n",
|
||||
" person.setdefault(str(code), {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 4).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 5).value\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0] \n",
|
||||
" dict1['unit'] = sheet.cell(n, 3).value\n",
|
||||
" if sheet.cell(n, 7).value is not None:\n",
|
||||
" dict1['phone'] = str(sheet.cell(n, 7).value)\n",
|
||||
" person[str(code)] = dict1\n",
|
||||
"filename = 'data/沧州炼化人员.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print(len(person),'ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "829d9460-a14e-4689-a7c4-d00bbd8c2e32",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-07T08:37:47.436725Z",
|
||||
"iopub.status.busy": "2025-11-07T08:37:47.435955Z",
|
||||
"iopub.status.idle": "2025-11-07T08:37:47.582958Z",
|
||||
"shell.execute_reply": "2025-11-07T08:37:47.582377Z",
|
||||
"shell.execute_reply.started": "2025-11-07T08:37:47.436655Z"
|
||||
"iopub.execute_input": "2025-11-16T05:42:54.899442Z",
|
||||
"iopub.status.busy": "2025-11-16T05:42:54.898753Z",
|
||||
"iopub.status.idle": "2025-11-16T05:42:55.048242Z",
|
||||
"shell.execute_reply": "2025-11-16T05:42:55.047690Z",
|
||||
"shell.execute_reply.started": "2025-11-16T05:42:54.899375Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -123,26 +156,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": null,
|
||||
"id": "7b6c8cb8-50ab-4b59-ac9a-6afb3db61476",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-09T05:35:48.182110Z",
|
||||
"iopub.status.busy": "2025-11-09T05:35:48.181365Z",
|
||||
"iopub.status.idle": "2025-11-09T05:35:48.197106Z",
|
||||
"shell.execute_reply": "2025-11-09T05:35:48.196434Z",
|
||||
"shell.execute_reply.started": "2025-11-09T05:35:48.182041Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1297 ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -175,15 +192,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"execution_count": 12,
|
||||
"id": "ccb2fe86-c588-4373-85df-37adda55c694",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-14T04:02:24.632013Z",
|
||||
"iopub.status.busy": "2025-11-14T04:02:24.631372Z",
|
||||
"iopub.status.idle": "2025-11-14T04:02:24.726424Z",
|
||||
"shell.execute_reply": "2025-11-14T04:02:24.725880Z",
|
||||
"shell.execute_reply.started": "2025-11-14T04:02:24.631959Z"
|
||||
"iopub.execute_input": "2025-11-17T01:44:40.400061Z",
|
||||
"iopub.status.busy": "2025-11-17T01:44:40.399563Z",
|
||||
"iopub.status.idle": "2025-11-17T01:44:40.476607Z",
|
||||
"shell.execute_reply": "2025-11-17T01:44:40.476073Z",
|
||||
"shell.execute_reply.started": "2025-11-17T01:44:40.400012Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -191,7 +208,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1175\n"
|
||||
"1225\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -205,7 +222,7 @@
|
||||
"filename = 'data/沧州炼化人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/marks_20251114.csv'\n",
|
||||
"filename = 'data/marks_20251117-1.csv'\n",
|
||||
"re_ta = My.get_result(filename,dict1)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -215,6 +232,67 @@
|
||||
"print(len(re_ta))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "0748c41c-bb8e-49e4-a88d-814928e9b956",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导入手工数据"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"id": "9054c821-24a6-4ec3-82b4-1af2fbfd5090",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-17T01:45:32.893349Z",
|
||||
"iopub.status.busy": "2025-11-17T01:45:32.892548Z",
|
||||
"iopub.status.idle": "2025-11-17T01:45:32.978502Z",
|
||||
"shell.execute_reply": "2025-11-17T01:45:32.977928Z",
|
||||
"shell.execute_reply.started": "2025-11-17T01:45:32.893261Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"122\n",
|
||||
"123\n",
|
||||
"1225\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/沧州俯卧撑手工成绩.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"filename = 'data/result_沧州炼化.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" code = str(sheet.cell(n, 1).value)\n",
|
||||
" item = 'pushup'\n",
|
||||
" mark = str(sheet.cell(n, 2).value)\n",
|
||||
" rq = str(sheet.cell(n, 3).value)\n",
|
||||
" if code in dict2.keys():\n",
|
||||
" dict2[code]['rq'] = rq\n",
|
||||
" dict2[code].setdefault(item,{})\n",
|
||||
" dict2[code][item]['成绩'] = mark\n",
|
||||
" else:\n",
|
||||
" print(code)\n",
|
||||
" \n",
|
||||
"filename = 'data/result_沧州炼化-1.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2, fl, ensure_ascii=False) \n",
|
||||
"print(len(re_ta)) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a446935a-db14-41d5-9420-d1a5ddd0e548",
|
||||
@@ -225,17 +303,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": null,
|
||||
"id": "503c30bb-c537-43f6-b3c7-a1eeff4c313f",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-14T04:02:34.921004Z",
|
||||
"iopub.status.busy": "2025-11-14T04:02:34.920268Z",
|
||||
"iopub.status.idle": "2025-11-14T04:02:34.953734Z",
|
||||
"shell.execute_reply": "2025-11-14T04:02:34.953246Z",
|
||||
"shell.execute_reply.started": "2025-11-14T04:02:34.920949Z"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -291,15 +361,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"execution_count": 7,
|
||||
"id": "57de7845-76f2-4cdc-88a9-eb869acb28a5",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-14T04:02:42.621335Z",
|
||||
"iopub.status.busy": "2025-11-14T04:02:42.620669Z",
|
||||
"iopub.status.idle": "2025-11-14T04:02:42.655530Z",
|
||||
"shell.execute_reply": "2025-11-14T04:02:42.654876Z",
|
||||
"shell.execute_reply.started": "2025-11-14T04:02:42.621305Z"
|
||||
"iopub.execute_input": "2025-11-17T01:05:50.422689Z",
|
||||
"iopub.status.busy": "2025-11-17T01:05:50.421236Z",
|
||||
"iopub.status.idle": "2025-11-17T01:05:50.450916Z",
|
||||
"shell.execute_reply": "2025-11-17T01:05:50.450368Z",
|
||||
"shell.execute_reply.started": "2025-11-17T01:05:50.422616Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -344,15 +414,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 34,
|
||||
"execution_count": 14,
|
||||
"id": "c2ca861f-54ca-4312-bf24-20dbc2f3f2e6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-14T04:11:04.381187Z",
|
||||
"iopub.status.busy": "2025-11-14T04:11:04.380519Z",
|
||||
"iopub.status.idle": "2025-11-14T04:11:04.413211Z",
|
||||
"shell.execute_reply": "2025-11-14T04:11:04.412250Z",
|
||||
"shell.execute_reply.started": "2025-11-14T04:11:04.381125Z"
|
||||
"iopub.execute_input": "2025-11-17T01:46:18.717093Z",
|
||||
"iopub.status.busy": "2025-11-17T01:46:18.716407Z",
|
||||
"iopub.status.idle": "2025-11-17T01:46:18.735809Z",
|
||||
"shell.execute_reply": "2025-11-17T01:46:18.735127Z",
|
||||
"shell.execute_reply.started": "2025-11-17T01:46:18.717026Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -361,17 +431,16 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1553238 齐金永 公用工程部 13231725301 2\n",
|
||||
"1553763 王鑫 应急救援中心 15632778668 2\n",
|
||||
"1552999 赵崇胜 储运部 13722775060 2\n",
|
||||
"01553836 王成柱 炼油一部 13111760190 1\n",
|
||||
"01553839 徐振柱 炼油一部 17772650508 1\n"
|
||||
"1553836 王成柱 炼油一部 13111760190 1\n",
|
||||
"1553839 徐振柱 炼油一部 17772650508 1\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"filename = 'data/result_沧州炼化.json'\n",
|
||||
"filename = 'data/result_沧州炼化-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"xm = ['bmi','lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n",
|
||||
@@ -384,10 +453,87 @@
|
||||
" print(k,v['name'],v['unit'],v['phone'],len(list1))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "57a9f492-6971-4572-9e9e-8086a49dc6ce",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导出测试人员信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"id": "e014e1f8-e13d-4bb1-a64a-606a3e44a876",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2025-11-17T01:46:49.086947Z",
|
||||
"iopub.status.busy": "2025-11-17T01:46:49.086254Z",
|
||||
"iopub.status.idle": "2025-11-17T01:46:49.440499Z",
|
||||
"shell.execute_reply": "2025-11-17T01:46:49.439939Z",
|
||||
"shell.execute_reply.started": "2025-11-17T01:46:49.086882Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"items = ['lung','grip','flexion','jump','pushup','situp','balance','reaction','step']\n",
|
||||
"title = ['编号','姓名','性别','单位','部门','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/result_沧州炼化-1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"filename = 'data/沧州炼化人员.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",
|
||||
" list2.append(dict2[k]['birth'])\n",
|
||||
" if 'phone' in v.keys():\n",
|
||||
" list2.append(dict2[k]['phone'])\n",
|
||||
" else:\n",
|
||||
" list2.append('')\n",
|
||||
" \n",
|
||||
" if 'bmi' in v.keys():\n",
|
||||
" height = v['bmi']['成绩'].split(',')[0]\n",
|
||||
" weight = v['bmi']['成绩'].split(',')[1]\n",
|
||||
" list2.append(height)\n",
|
||||
" list2.append(weight)\n",
|
||||
" else:\n",
|
||||
" list2.append('')\n",
|
||||
" list2.append('')\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",
|
||||
" \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/沧州炼化体测情况表(2025年)-1.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": "code",
|
||||
"execution_count": null,
|
||||
"id": "e6dea90d-2b60-4ff5-9598-a49f41b6ab24",
|
||||
"id": "4042e92b-1d63-489a-9652-3f9f48453db8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user