This commit is contained in:
512song committed 2023-04-27 19:28:57 +08:00
1 parent d5af3bcb91
commit f03e964585
3 files changed
+475 -68

No files matched your search

+381 -35
View File
@@ -10,15 +10,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 110, "execution_count": 138,
"id": "1b92b7c5-cb77-49da-95b7-34827ecf1d16", "id": "1b92b7c5-cb77-49da-95b7-34827ecf1d16",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-04-25T10:41:09.138090Z", "iopub.execute_input": "2023-04-27T11:13:41.777211Z",
"iopub.status.busy": "2023-04-25T10:41:09.137225Z", "iopub.status.busy": "2023-04-27T11:13:41.776344Z",
"iopub.status.idle": "2023-04-25T10:41:11.696860Z", "iopub.status.idle": "2023-04-27T11:13:44.240985Z",
"shell.execute_reply": "2023-04-25T10:41:11.695874Z", "shell.execute_reply": "2023-04-27T11:13:44.239943Z",
"shell.execute_reply.started": "2023-04-25T10:41:09.138049Z" "shell.execute_reply.started": "2023-04-27T11:13:41.777171Z"
}, },
"tags": [] "tags": []
}, },
@@ -89,15 +89,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 111, "execution_count": 141,
"id": "71e1ec6a-6797-4496-969a-1d1461b9ea58", "id": "71e1ec6a-6797-4496-969a-1d1461b9ea58",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-04-25T10:41:24.604593Z", "iopub.execute_input": "2023-04-27T11:17:30.688334Z",
"iopub.status.busy": "2023-04-25T10:41:24.603754Z", "iopub.status.busy": "2023-04-27T11:17:30.687922Z",
"iopub.status.idle": "2023-04-25T10:41:24.838577Z", "iopub.status.idle": "2023-04-27T11:17:31.209520Z",
"shell.execute_reply": "2023-04-25T10:41:24.837823Z", "shell.execute_reply": "2023-04-27T11:17:31.208618Z",
"shell.execute_reply.started": "2023-04-25T10:41:24.604553Z" "shell.execute_reply.started": "2023-04-27T11:17:30.688305Z"
}, },
"tags": [] "tags": []
}, },
@@ -106,9 +106,20 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"454\n", "358\n",
"454\n", "1987 孙伟滨 已测试!\n",
"3099\n" "1402 郭力 已测试!\n",
"1968 项征 已测试!\n",
"1980 张艳梅 已测试!\n",
"2243 李宁 已测试!\n",
"2252 张宝山 已测试!\n",
"1398 李海峰 已测试!\n",
"999 张术申 已测试!\n",
"6199 张杰 已测试!\n",
"1681 何志坚 已测试!\n",
"383 肖建国 已测试!\n",
"358\n",
"4229\n"
] ]
} }
], ],
@@ -131,7 +142,7 @@
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n", " dict1 = json.load(fl) \n",
"\n", "\n",
"filename = 'data/places_result_20230425.csv'\n", "filename = 'data/places_result_20230427.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n", "with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n", " fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n", " header = next(fl) \n",
@@ -164,7 +175,7 @@
" else:\n", " else:\n",
" for k1,v1 in v.items():\n", " for k1,v1 in v.items():\n",
" dict2[k][k1] = v1\n", " dict2[k][k1] = v1\n",
"filename = 'data/result_燕山石化(20230425).json'\n", "filename = 'data/result_燕山石化(20230427).json'\n",
"with open(filename,'w') as fl:\n", "with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n", " json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))\n", "print(len(re_ta))\n",
@@ -184,15 +195,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 112, "execution_count": 143,
"id": "c24880ad-bbbd-4ad8-a894-cbcea389e822", "id": "c24880ad-bbbd-4ad8-a894-cbcea389e822",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-04-25T10:41:45.914369Z", "iopub.execute_input": "2023-04-27T11:20:46.486381Z",
"iopub.status.busy": "2023-04-25T10:41:45.913494Z", "iopub.status.busy": "2023-04-27T11:20:46.485740Z",
"iopub.status.idle": "2023-04-25T10:41:46.098743Z", "iopub.status.idle": "2023-04-27T11:20:46.658108Z",
"shell.execute_reply": "2023-04-25T10:41:46.098046Z", "shell.execute_reply": "2023-04-27T11:20:46.657410Z",
"shell.execute_reply.started": "2023-04-25T10:41:45.914321Z" "shell.execute_reply.started": "2023-04-27T11:20:46.486341Z"
}, },
"tags": [] "tags": []
}, },
@@ -203,7 +214,8 @@
"\n", "\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','性别','单位','车间','班组','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "title = ['编号','姓名','性别','单位','车间','班组','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_燕山石化(20230425).json'\n", "\n",
"filename = 'data/result_燕山石化(20230427).json'\n",
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n", " dict1 = json.load(fl)\n",
"\n", "\n",
@@ -228,7 +240,7 @@
" else:\n", " else:\n",
" list2.append('') \n", " list2.append('') \n",
" list1.append(list2)\n", " list1.append(list2)\n",
"filename = 'data/燕山石化体测情况表(20230425).xlsx'\n", "filename = 'data/燕山石化体测情况表(20230427).xlsx'\n",
"wb = openpyxl.Workbook()\n", "wb = openpyxl.Workbook()\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"sheet.append(title)\n", "sheet.append(title)\n",
@@ -248,15 +260,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 113, "execution_count": 144,
"id": "68454877-f1fe-4eed-8a48-265e428f892e", "id": "68454877-f1fe-4eed-8a48-265e428f892e",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-04-25T10:41:58.467679Z", "iopub.execute_input": "2023-04-27T11:21:48.040006Z",
"iopub.status.busy": "2023-04-25T10:41:58.467274Z", "iopub.status.busy": "2023-04-27T11:21:48.039202Z",
"iopub.status.idle": "2023-04-25T10:41:58.499250Z", "iopub.status.idle": "2023-04-27T11:21:48.069140Z",
"shell.execute_reply": "2023-04-25T10:41:58.498205Z", "shell.execute_reply": "2023-04-27T11:21:48.068103Z",
"shell.execute_reply.started": "2023-04-25T10:41:58.467652Z" "shell.execute_reply.started": "2023-04-27T11:21:48.039973Z"
}, },
"tags": [] "tags": []
}, },
@@ -265,7 +277,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"{'行政事务中心(离退中心)工会': 18, '炼油厂工会': 95, '化学品厂工会': 67, '高科公司工会': 109, '烯烃厂工会': 13, '有机化工厂工会': 98, '储运厂工会': 8, '检验计量中心工会': 16, '教育培训中心工会': 1, '合成橡胶厂工会': 10, '合成树脂厂': 10, '消防中心工会': 1, '生产运行保障中心': 1, '物装中心工会': 2, '机关工会': 5}\n" "{'合成橡胶厂工会': 30, '炼油厂工会': 95, '检验计量中心工会': 16, '烯烃厂工会': 115, '化学品厂工会': 29, '合成树脂厂': 10, '有机化工厂工会': 30, '储运厂工会': 12, '机关工会': 6, '高科公司工会': 9, '热电厂工会': 1, '物装中心工会': 5}\n"
] ]
} }
], ],
@@ -273,7 +285,7 @@
"import json\n", "import json\n",
"import openpyxl\n", "import openpyxl\n",
"\n", "\n",
"filename = 'data/result_燕山石化(20230425).json'\n", "filename = 'data/result_燕山石化(20230427).json'\n",
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n", " dict1 = json.load(fl)\n",
"dict2 = {}\n", "dict2 = {}\n",
@@ -288,7 +300,7 @@
" list2 = []\n", " list2 = []\n",
" list2 = [k,v]\n", " list2 = [k,v]\n",
" list1.append(list2)\n", " list1.append(list2)\n",
"filename = 'data/燕山石化部门测试人数情况表(20230425).xlsx'\n", "filename = 'data/燕山石化部门测试人数情况表(20230427).xlsx'\n",
"wb = openpyxl.Workbook()\n", "wb = openpyxl.Workbook()\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"sheet.append(title)\n", "sheet.append(title)\n",
@@ -355,10 +367,344 @@
"wb.save(filename) " "wb.save(filename) "
] ]
}, },
{
"cell_type": "markdown",
"id": "3231f52d-776f-4d29-b6f5-c28f6a0c30a9",
"metadata": {},
"source": [
"## 汇总未测试人员情况表"
]
},
{
"cell_type": "code",
"execution_count": 118,
"id": "eddf7dab-b28d-402a-aeaf-27c120048ecb",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-26T10:55:40.757537Z",
"iopub.status.busy": "2023-04-26T10:55:40.756689Z",
"iopub.status.idle": "2023-04-26T10:55:41.510205Z",
"shell.execute_reply": "2023-04-26T10:55:41.509509Z",
"shell.execute_reply.started": "2023-04-26T10:55:40.757497Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"\n",
"title = ['编号','姓名','性别','单位','车间','班组']\n",
"filename = 'data/result_燕山石化.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",
"list1 = []\n",
"for k, v in dict2.items():\n",
" list2 = []\n",
" if k not in dict1.keys():\n",
" list2.append(str(k).rjust(5,'0'))\n",
" list2.append(v['name']) \n",
" list2.append(dict2[k]['sex'])\n",
" list2.append(dict2[k]['工作单位']) \n",
" list2.append(dict2[k]['车间'])\n",
" list2.append(dict2[k]['班组'])\n",
" list1.append(list2)\n",
"filename = 'data/燕山石化未体测人员名单(截至20230426).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": "4dd9b2b7-bd3d-4d5b-ac84-3a49bcada8b5",
"metadata": {},
"source": [
"## 统计测试项目不足人员"
]
},
{
"cell_type": "code",
"execution_count": 123,
"id": "641863ef-324f-4c33-a0a9-699031afb6f1",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-26T11:17:42.517140Z",
"iopub.status.busy": "2023-04-26T11:17:42.516342Z",
"iopub.status.idle": "2023-04-26T11:17:42.630705Z",
"shell.execute_reply": "2023-04-26T11:17:42.629971Z",
"shell.execute_reply.started": "2023-04-26T11:17:42.517107Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"7756 张志兴 ['身高', '体重', '肺活量', '握力']\n",
"3999 解勇 ['身高', '体重', '肺活量', '握力']\n",
"7037 郭维东 ['身高', '体重', '握力', '选择反应时']\n",
"57 郑文芬 ['身高', '体重', '坐位体前屈', '握力']\n",
"4031 庞荔元 ['身高', '体重', '肺活量', '选择反应时']\n",
"4025 马珺 ['身高', '体重', '选择反应时']\n",
"7790 吴志鹏 ['身高', '体重', '握力']\n",
"4851 李晓甦 ['身高', '体重', '单脚站立', '握力']\n",
"8133 张来强 ['身高', '体重', '肺活量', '选择反应时']\n",
"5628 康文刚 ['身高', '体重', '肺活量', '握力']\n",
"8151 赵春先 ['身高', '体重', '握力']\n",
"3699 毛树新 ['身高', '体重', '纵跳', '选择反应时']\n",
"1699 孙雪飞 ['身高', '体重', '肺活量', '选择反应时']\n",
"1960 徐慧国 ['身高', '体重', '肺活量', '单脚站立']\n",
"3563 孙志强 ['身高', '体重', '握力', '纵跳']\n",
"7682 孙宏林 ['肺活量', '身高', '体重']\n",
"4370 张宝 ['身高', '体重', '肺活量', '选择反应时']\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",
" dict1 = json.load(fl)\n",
"\n",
"filename = 'data/燕山石化人员名单.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"dict3 = {}\n",
"for k, v in dict1.items():\n",
" list1 = []\n",
" for item in v.keys():\n",
" if item in items:\n",
" list1.append(item)\n",
" dict3[k] = list1\n",
"for k, v in dict3.items():\n",
" if len(v)<=4 and '身高' in v and '体重' in v:\n",
" print(k,dict2[k]['name'],v)\n",
" "
]
},
{
"cell_type": "markdown",
"id": "d3a69840-29fc-434d-af47-ad864f9e511c",
"metadata": {},
"source": [
"## 汇总成绩导入"
]
},
{
"cell_type": "code",
"execution_count": 142,
"id": "b735248a-c1b0-4e90-8df4-37cd7625cb1a",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-27T11:19:41.635154Z",
"iopub.status.busy": "2023-04-27T11:19:41.634745Z",
"iopub.status.idle": "2023-04-27T11:19:41.975500Z",
"shell.execute_reply": "2023-04-27T11:19:41.974722Z",
"shell.execute_reply.started": "2023-04-27T11:19:41.635125Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3802\n",
"3802\n"
]
}
],
"source": [
"import json\n",
"import time\n",
"import csv\n",
"\n",
"filename = '../item.json'\n",
"item = {}\n",
"unit = {}\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"for k,v in dict1.items():\n",
" item[k] = v\n",
"re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/燕山石化人员名单.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20230427-all.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
" for line in fl:\n",
" #line = re.sub('[\\r\\n\\f ]{1,}', '', line)\n",
" list1.append(line)\n",
"#print(list1)\n",
"for result in list1:\n",
" user = str(result[2])\n",
" if user in dict1.keys(): \n",
" m_item = str(result[3]) \n",
" re_ta.setdefault(user,{}) \n",
" re_ta[user]['name'] = dict1[user]['name']\n",
" re_ta[user]['sex'] = dict1[user]['sex'] \n",
" re_ta[user]['部门'] = dict1[user]['工作单位']\n",
" item_name = item[m_item]['name']\n",
" re_ta[user].setdefault(item_name,{}) \n",
" 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",
"\n",
"filename = 'data/result_燕山石化-all.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
"print(len(re_ta))"
]
},
{
"cell_type": "markdown",
"id": "5bdcad97-309f-4d29-82c4-b53c68b9ee22",
"metadata": {},
"source": [
"## 统计重复人员信息"
]
},
{
"cell_type": "code",
"execution_count": 132,
"id": "0dd5da15-92e0-45c2-b9e9-11417210974e",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-27T07:22:33.663659Z",
"iopub.status.busy": "2023-04-27T07:22:33.662808Z",
"iopub.status.idle": "2023-04-27T07:22:35.472369Z",
"shell.execute_reply": "2023-04-27T07:22:35.471662Z",
"shell.execute_reply.started": "2023-04-27T07:22:33.663618Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import time\n",
"import csv\n",
"\n",
"\n",
"list1 = []\n",
"list2 = set()\n",
"filename = 'data/燕山石化人员名单.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/result_燕山石化-all.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"\n",
"for k,v in dict1.items():\n",
" name = v['name']\n",
" if name in list1:\n",
" list2.add(name)\n",
" list1.append(name)\n",
"list3 = []\n",
"for item in list2:\n",
" for k,v in dict1.items():\n",
" if v['name'] == item:\n",
" list3.append([k,v['name'],v['sex'],v['birth']])\n",
"filename = 'data/燕山石化重名人员名单.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"#sheet.append(title)\n",
"for row in list3:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename) "
]
},
{
"cell_type": "markdown",
"id": "96375506-0cca-4a9b-b0da-162460d25e51",
"metadata": {},
"source": [
"## 重复人员测试情况"
]
},
{
"cell_type": "code",
"execution_count": 137,
"id": "5df8eb8f-3594-40be-a491-b4d750bbd554",
"metadata": {
"execution": {
"iopub.execute_input": "2023-04-27T08:23:39.947764Z",
"iopub.status.busy": "2023-04-27T08:23:39.947326Z",
"iopub.status.idle": "2023-04-27T08:23:40.072095Z",
"shell.execute_reply": "2023-04-27T08:23:40.071367Z",
"shell.execute_reply.started": "2023-04-27T08:23:39.947734Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import time\n",
"import csv\n",
"\n",
"\n",
"list1 = []\n",
"list2 = set()\n",
"filename = 'data/燕山石化人员名单.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"filename = 'data/result_燕山石化-all.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"\n",
"\n",
"list3 = []\n",
"\n",
"filename = 'data/燕山石化重名人员名单.xlsx'\n",
"wb = openpyxl.load_workbook(filename)\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"\n",
"\n",
"for n in range(1, sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n",
" code = int(sheet.cell(n, 1).value)\n",
" name = dict1[str(code)]['name']\n",
" unit = dict1[str(code)]['工作单位']\n",
" if str(code) in dict2.keys():\n",
" ce = '是'\n",
" else:\n",
" ce = '否'\n",
" list3.append([code,name,unit,ce])\n",
"filename = 'data/燕山石化重名人员测试情况.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"#sheet.append(title)\n",
"for row in list3:\n",
" sheet.append(row)\n",
" \n",
"wb.save(filename) "
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "6e1dda56-541b-4afe-8ae7-2a8dd7ec5eac", "id": "bfd8e77d-85a5-44aa-b075-b37278910a3f",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
+88 -27
View File
@@ -53,8 +53,6 @@
" sex = '女'\n", " sex = '女'\n",
" dict1['sex'] = sex\n", " dict1['sex'] = sex\n",
" dict1['unit'] = sheet.cell(n, 3).value\n", " dict1['unit'] = sheet.cell(n, 3).value\n",
"\n",
"\n",
" person[code] = dict1\n", " person[code] = dict1\n",
"filename = 'data/石家庄2023.json'\n", "filename = 'data/石家庄2023.json'\n",
"with open(filename, 'w') as fl:\n", "with open(filename, 'w') as fl:\n",
@@ -72,15 +70,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 36,
"id": "dd3c65ea-cc8a-4f1b-8698-d1799f99e101", "id": "dd3c65ea-cc8a-4f1b-8698-d1799f99e101",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-04-26T09:36:18.999273Z", "iopub.execute_input": "2023-04-27T07:07:34.179338Z",
"iopub.status.busy": "2023-04-26T09:36:18.998427Z", "iopub.status.busy": "2023-04-27T07:07:34.178517Z",
"iopub.status.idle": "2023-04-26T09:36:19.081109Z", "iopub.status.idle": "2023-04-27T07:07:34.222956Z",
"shell.execute_reply": "2023-04-26T09:36:19.080378Z", "shell.execute_reply": "2023-04-27T07:07:34.221926Z",
"shell.execute_reply.started": "2023-04-26T09:36:18.999232Z" "shell.execute_reply.started": "2023-04-27T07:07:34.179297Z"
}, },
"tags": [] "tags": []
}, },
@@ -89,7 +87,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"454\n", "118\n",
"ok\n" "ok\n"
] ]
} }
@@ -113,7 +111,7 @@
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n", " dict1 = json.load(fl) \n",
"\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", "with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n", " fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n", " header = next(fl) \n",
@@ -135,7 +133,7 @@
" score = int(result[4])/item[m_item]['divisor'] \n", " score = int(result[4])/item[m_item]['divisor'] \n",
" re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n", " re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n",
"print(len(re_ta))\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", "with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl) \n", " json.dump(re_ta, fl) \n",
"print('ok')" "print('ok')"
@@ -151,15 +149,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 37,
"id": "97d86ce2-6664-41a1-89d2-ddaa0611bac1", "id": "97d86ce2-6664-41a1-89d2-ddaa0611bac1",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-04-26T09:37:10.787453Z", "iopub.execute_input": "2023-04-27T07:07:54.855417Z",
"iopub.status.busy": "2023-04-26T09:37:10.786596Z", "iopub.status.busy": "2023-04-27T07:07:54.854561Z",
"iopub.status.idle": "2023-04-26T09:37:10.924736Z", "iopub.status.idle": "2023-04-27T07:07:54.933949Z",
"shell.execute_reply": "2023-04-26T09:37:10.923992Z", "shell.execute_reply": "2023-04-27T07:07:54.932922Z",
"shell.execute_reply.started": "2023-04-26T09:37:10.787410Z" "shell.execute_reply.started": "2023-04-27T07:07:54.855376Z"
}, },
"tags": [] "tags": []
}, },
@@ -170,7 +168,7 @@
"\n", "\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n", "title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"filename = 'data/result_石家庄(20230426).json'\n", "filename = 'data/result_石家庄(20230427).json'\n",
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n", " dict1 = json.load(fl)\n",
"\n", "\n",
@@ -194,7 +192,7 @@
" else:\n", " else:\n",
" list2.append('') \n", " list2.append('') \n",
" list1.append(list2)\n", " list1.append(list2)\n",
"filename = 'data/石家庄石化体测情况表(20230426).xlsx'\n", "filename = 'data/石家庄石化体测情况表(20230427).xlsx'\n",
"wb = openpyxl.Workbook()\n", "wb = openpyxl.Workbook()\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"sheet.append(title)\n", "sheet.append(title)\n",
@@ -214,15 +212,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 38,
"id": "e2b68cb1-3a6f-4b51-afbd-d6c9634348b1", "id": "e2b68cb1-3a6f-4b51-afbd-d6c9634348b1",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-04-26T09:38:27.401785Z", "iopub.execute_input": "2023-04-27T07:10:23.308568Z",
"iopub.status.busy": "2023-04-26T09:38:27.401110Z", "iopub.status.busy": "2023-04-27T07:10:23.307717Z",
"iopub.status.idle": "2023-04-26T09:38:27.597084Z", "iopub.status.idle": "2023-04-27T07:10:23.593399Z",
"shell.execute_reply": "2023-04-26T09:38:27.596368Z", "shell.execute_reply": "2023-04-27T07:10:23.592690Z",
"shell.execute_reply.started": "2023-04-26T09:38:27.401745Z" "shell.execute_reply.started": "2023-04-27T07:10:23.308525Z"
}, },
"tags": [] "tags": []
}, },
@@ -231,7 +229,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"2140\n", "2254\n",
"ok\n" "ok\n"
] ]
} }
@@ -255,7 +253,7 @@
"with open(filename,'r') as fl:\n", "with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n", " dict1 = json.load(fl) \n",
"\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", "with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n", " fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n", " header = next(fl) \n",
@@ -283,6 +281,69 @@
"print('ok')" "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", "cell_type": "markdown",
"id": "e5de157c-18e2-4a6a-bae8-3db88822b88f", "id": "e5de157c-18e2-4a6a-bae8-3db88822b88f",
+6 -6
View File
@@ -364,14 +364,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 6,
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-04-24T10:49:01.806558Z", "iopub.execute_input": "2023-04-27T09:20:28.067998Z",
"iopub.status.busy": "2023-04-24T10:49:01.805728Z", "iopub.status.busy": "2023-04-27T09:20:28.067295Z",
"iopub.status.idle": "2023-04-24T10:49:01.923255Z", "iopub.status.idle": "2023-04-27T09:20:28.183642Z",
"shell.execute_reply": "2023-04-24T10:49:01.922357Z", "shell.execute_reply": "2023-04-27T09:20:28.182659Z",
"shell.execute_reply.started": "2023-04-24T10:49:01.806518Z" "shell.execute_reply.started": "2023-04-27T09:20:28.067958Z"
}, },
"tags": [] "tags": []
}, },