This commit is contained in:
512song committed 2024-06-13 13:44:25 +08:00
1 parent 76487f10e8
commit f44b30e86f
4 files changed
+3702 -1138

No files matched your search

+345 -27
View File
@@ -15,13 +15,105 @@
"cell_type": "markdown",
"id": "112d80f4-607b-41f9-bb30-ac2eb8f52ee2",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
"## 基础数据管理"
]
},
{
"cell_type": "markdown",
"id": "9a06725f-248b-44dd-b029-c18e7c0689ee",
"metadata": {},
"source": [
"### 体测数据按编号汇总"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "47aa588c-1880-44a8-add0-6fad777065d6",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-12T09:11:49.898532Z",
"iopub.status.busy": "2024-06-12T09:11:49.897811Z",
"iopub.status.idle": "2024-06-12T09:11:49.930322Z",
"shell.execute_reply": "2024-06-12T09:11:49.929864Z",
"shell.execute_reply.started": "2024-06-12T09:11:49.898469Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"51\n"
]
}
],
"source": [
"import json\n",
"import time\n",
"import csv\n",
"\n",
"filename = '../item.json'\n",
"item = {}\n",
"bh = set()\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",
"list2 = []\n",
"rq = '20240612'\n",
"filename = f'data/places_result_{rq}.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",
" bh.add(line[2])\n",
" \n",
"#print(list1)\n",
"for result in list1:\n",
" user = str(result[2])\n",
" \n",
" m_item = str(result[3]) \n",
" re_ta.setdefault(user,{}) \n",
" \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",
"\n",
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"title = ['编号','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"list1 = []\n",
"for k, v in re_ta.items():\n",
" list2 = []\n",
" list2.append(str(k))\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 = f'data/长炼医院体测情况表({rq}).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"sheet.append(title)\n",
"for row in list1:\n",
" sheet.append(row)\n",
"wb.save(filename)"
]
},
{
"cell_type": "markdown",
"id": "b7dfd50f-a614-497d-8f0a-fa1e4c89168a",
@@ -1508,16 +1600,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 15,
"id": "46aa847d-e1fe-45bd-85b6-e2d792ec8842",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:09:32.204611Z",
"iopub.status.busy": "2024-06-13T05:09:32.203867Z",
"iopub.status.idle": "2024-06-13T05:09:32.254750Z",
"shell.execute_reply": "2024-06-13T05:09:32.254194Z",
"shell.execute_reply.started": "2024-06-13T05:09:32.204544Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"\n",
"filename = 'data/result_北海炼化2023.json'\n",
"filename = 'data/result_中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
@@ -1537,7 +1645,7 @@
"\n",
"\n",
"list1 = []\n",
"fiie_path ='./138/'\n",
"#fiie_path ='./138/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=1\n",
"list2 = []\n",
@@ -1570,7 +1678,7 @@
" mydata['score'] = round(score/len(mydata['fits']),2)\n",
" if len(mydata['fits']) >2:\n",
" dict2[str(k)] = mydata\n",
"filename = f'data/data_北海炼化2023.json'\n",
"filename = f'data/data_中安联合.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
@@ -1586,15 +1694,32 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"id": "63edd636-f034-4aa6-8575-63d5cdb84adb",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:10:12.371475Z",
"iopub.status.busy": "2024-06-13T05:10:12.370716Z",
"iopub.status.idle": "2024-06-13T05:10:12.388967Z",
"shell.execute_reply": "2024-06-13T05:10:12.388430Z",
"shell.execute_reply.started": "2024-06-13T05:10:12.371406Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"平均成绩:2.8023分,男性:566人\n",
"平均成绩:3.216分,女性:143人\n",
"平均成绩:2.8858分,总体:709人\n"
]
}
],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"filename = 'data/data_长炼医院.json'\n",
"filename = 'data/data_中安联合.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"i = 1\n",
@@ -1628,18 +1753,38 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"id": "1b4a3f02-9b2e-41fc-ac6c-8163907a07f1",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:14:51.442511Z",
"iopub.status.busy": "2024-06-13T05:14:51.441746Z",
"iopub.status.idle": "2024-06-13T05:14:51.479067Z",
"shell.execute_reply": "2024-06-13T05:14:51.478465Z",
"shell.execute_reply.started": "2024-06-13T05:14:51.442442Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0~255分人数:171人,男性:161人,女性:10人\n",
"256~332分人数:359人,男性:296人,女性:63人\n",
"333~367分人数:135人,男性:83人,女性:52人\n",
"368~500分人数:44人,男性:26人,女性:18人\n",
"709\n",
"ok\n"
]
}
],
"source": [
"import json\n",
"\n",
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"\n",
"filename = 'data/data_长炼医院.json'\n",
"#filename = 'data/data_长炼医院.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"dict2 = {}\n",
@@ -1679,12 +1824,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"id": "2d661ca6-6129-4da1-ac25-51d0156babb2",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:15:48.332407Z",
"iopub.status.busy": "2024-06-13T05:15:48.331591Z",
"iopub.status.idle": "2024-06-13T05:15:48.345913Z",
"shell.execute_reply": "2024-06-13T05:15:48.345319Z",
"shell.execute_reply.started": "2024-06-13T05:15:48.332331Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {'不合格': 8, '合格': 11, '良好': 7, '优秀': 1}\n",
"25-29 {'合格': 23, '不合格': 0, '良好': 13, '优秀': 4}\n",
"30-34 {'合格': 15, '良好': 13, '不合格': 1, '优秀': 4}\n",
"35-39 {'不合格': 0, '合格': 4, '良好': 9, '优秀': 2}\n",
"40-44 {'合格': 1, '不合格': 1, '良好': 3, '优秀': 2}\n",
"45-49 {'良好': 6, '合格': 8, '不合格': 0, '优秀': 1}\n",
"50-54 {'优秀': 4, '良好': 1, '合格': 1, '不合格': 0}\n",
"55-80 {'良好': 0, '优秀': 0, '不合格': 0, '合格': 0}\n"
]
}
],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1724,12 +1891,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 19,
"id": "fc97df37-34ff-4a02-9d26-b5d81b706e46",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:16:40.847731Z",
"iopub.status.busy": "2024-06-13T05:16:40.846984Z",
"iopub.status.idle": "2024-06-13T05:16:40.868388Z",
"shell.execute_reply": "2024-06-13T05:16:40.867842Z",
"shell.execute_reply.started": "2024-06-13T05:16:40.847661Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20-24 {'不合格': 37, '合格': 45, '良好': 9, '优秀': 0}\n",
"25-29 {'合格': 110, '不合格': 69, '良好': 12, '优秀': 1}\n",
"30-34 {'合格': 47, '良好': 10, '不合格': 25, '优秀': 0}\n",
"35-39 {'不合格': 12, '合格': 22, '良好': 9, '优秀': 9}\n",
"40-44 {'合格': 19, '不合格': 6, '良好': 8, '优秀': 3}\n",
"45-49 {'良好': 11, '合格': 32, '不合格': 6, '优秀': 1}\n",
"50-54 {'优秀': 7, '良好': 13, '合格': 10, '不合格': 3}\n",
"55-80 {'良好': 11, '优秀': 5, '不合格': 3, '合格': 11}\n"
]
}
],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1769,12 +1958,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 20,
"id": "dafb86f8-5ee0-4c87-a98f-c7ff0f631fe5",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:18:41.529045Z",
"iopub.status.busy": "2024-06-13T05:18:41.528337Z",
"iopub.status.idle": "2024-06-13T05:18:41.549760Z",
"shell.execute_reply": "2024-06-13T05:18:41.548768Z",
"shell.execute_reply.started": "2024-06-13T05:18:41.528978Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"16~24岁平均成绩:2.66分,人数:118人,男性:91人\n",
"25~29岁平均成绩:2.76分,人数:232人,男性:192人\n",
"30~34岁平均成绩:2.86分,人数:115人,男性:82人\n",
"35~39岁平均成绩:3.12分,人数:67人,男性:52人\n",
"40~44岁平均成绩:3.0分,人数:43人,男性:36人\n",
"45~49岁平均成绩:3.02分,人数:65人,男性:50人\n",
"50~54岁平均成绩:3.37分,人数:39人,男性:33人\n",
"55~69岁平均成绩:3.25分,人数:30人,男性:30人\n"
]
}
],
"source": [
"nld = [[16,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n",
"\n",
@@ -1809,12 +2020,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"id": "347703a1-501b-4800-bd29-16e94f4a6793",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:23:58.151945Z",
"iopub.status.busy": "2024-06-13T05:23:58.151212Z",
"iopub.status.idle": "2024-06-13T05:23:58.169300Z",
"shell.execute_reply": "2024-06-13T05:23:58.168282Z",
"shell.execute_reply.started": "2024-06-13T05:23:58.151877Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:2.61分,人数:91人\n",
"25~29岁平均成绩:2.67分,人数:192人\n",
"30~34岁平均成绩:2.69分,人数:82人\n",
"35~39岁平均成绩:3.02分,人数:52人\n",
"40~44岁平均成绩:2.92分,人数:36人\n",
"45~49岁平均成绩:2.96分,人数:50人\n",
"50~54岁平均成绩:3.29分,人数:33人\n",
"55~80岁平均成绩:3.25分,人数:30人\n"
]
}
],
"source": [
"import json\n",
"\n",
@@ -1849,12 +2082,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 24,
"id": "5900d1c7-2f8c-4dfa-a60e-a577fb90f22d",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:24:23.022565Z",
"iopub.status.busy": "2024-06-13T05:24:23.022002Z",
"iopub.status.idle": "2024-06-13T05:24:23.043238Z",
"shell.execute_reply": "2024-06-13T05:24:23.042535Z",
"shell.execute_reply.started": "2024-06-13T05:24:23.022513Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"20~24岁平均成绩:2.86分,人数:27人\n",
"25~29岁平均成绩:3.19分,人数:40人\n",
"30~34岁平均成绩:3.29分,人数:33人\n",
"35~39岁平均成绩:3.45分,人数:15人\n",
"40~44岁平均成绩:3.4分,人数:7人\n",
"45~49岁平均成绩:3.2分,人数:15人\n",
"50~54岁平均成绩:3.82分,人数:6人\n",
"55~80岁平均成绩:0分,人数:0人\n"
]
}
],
"source": [
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
"\n",
@@ -1887,12 +2142,36 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 21,
"id": "ad69c45d-3f62-42df-894d-47424e759029",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:20:24.418670Z",
"iopub.status.busy": "2024-06-13T05:20:24.417910Z",
"iopub.status.idle": "2024-06-13T05:20:24.434900Z",
"shell.execute_reply": "2024-06-13T05:20:24.434312Z",
"shell.execute_reply.started": "2024-06-13T05:20:24.418603Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"BMI 3.48 706\n",
"肺活量 3.33 707\n",
"握力 2.33 706\n",
"坐位体前屈 3.07 692\n",
"纵跳 2.94 685\n",
"俯卧撑 2.56 542\n",
"一分钟仰卧起坐 4.01 134\n",
"单脚站立 2.74 700\n",
"选择反应时 2.89 707\n",
"台阶指数 2.29 652\n"
]
}
],
"source": [
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
@@ -1917,12 +2196,51 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 22,
"id": "dcf152e7-bbcc-47d1-9c5f-83854db35412",
"metadata": {
"execution": {
"iopub.execute_input": "2024-06-13T05:20:27.455180Z",
"iopub.status.busy": "2024-06-13T05:20:27.454431Z",
"iopub.status.idle": "2024-06-13T05:20:27.477168Z",
"shell.execute_reply": "2024-06-13T05:20:27.476614Z",
"shell.execute_reply.started": "2024-06-13T05:20:27.455096Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"煤气化部气化装置 2.7 82\n",
"煤气化部空分装置 2.79 43\n",
"烯烃部 2.8 171\n",
"安全环保部 3.56 11\n",
"企管法律部 3.06 4\n",
"储运部 3.18 19\n",
"供销部 3.15 13\n",
"原料成品区 2.84 20\n",
"党群工作部(党委办公室) 3.04 9\n",
"分检中心机关 3.52 8\n",
"公用工程分析区 3.23 11\n",
"甲醇部 2.87 100\n",
"财务资产部 3.17 9\n",
"甲醇分析区 2.66 12\n",
"公用工程部 2.81 105\n",
"煤气化部 3.37 6\n",
"综合管理部 3.04 6\n",
"电仪中心 3.15 16\n",
"烯烃分析区 2.81 14\n",
"生产计划部 3.17 14\n",
"技术质量部 3.05 14\n",
"监督审计部 3.17 3\n",
"党委组织部(人力资源部) 3.12 6\n",
"生产经营部 3.33 3\n",
"设备工程部 2.89 10\n"
]
}
],
"source": [
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",