20231114
This commit is contained in:
1 parent
bec78cd290
commit
2185fd37aa
2 files changed
+338
-41
No files matched your search
+228
-24
@@ -2308,7 +2308,7 @@
|
||||
"for fn in fls:\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0]\n",
|
||||
" code = int(fi_name)\n",
|
||||
" if dict1[str(code)]['sex'] =='女': \n",
|
||||
" if dict1[str(code)]['sex'] =='男': \n",
|
||||
" unit_path = Path(new_path,dict1[str(code)]['unit'])\n",
|
||||
" unit_path.mkdir(parents = True, exist_ok = True)\n",
|
||||
" n_name = Path(unit_path,Path(fn).stem+'.pdf')\n",
|
||||
@@ -2369,12 +2369,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 92,
|
||||
"id": "91fbc553-da7c-4c1e-bcf3-944dc59204b6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-14T06:24:29.017502Z",
|
||||
"iopub.status.busy": "2023-11-14T06:24:29.016683Z",
|
||||
"iopub.status.idle": "2023-11-14T06:24:29.082247Z",
|
||||
"shell.execute_reply": "2023-11-14T06:24:29.081478Z",
|
||||
"shell.execute_reply.started": "2023-11-14T06:24:29.017425Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[]\n",
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
@@ -2393,13 +2409,13 @@
|
||||
" list2 = []\n",
|
||||
" fi_name =Path(fn).stem.split('-')[0] \n",
|
||||
" code = int(fi_name)\n",
|
||||
" if dict1[str(code)]['sex'] =='女':\n",
|
||||
" if dict1[str(code)]['sex'] =='男':\n",
|
||||
" unit = dict1[str(code)]['unit']\n",
|
||||
" list2 = [fi_name,Path(fn).stem.split('-')[1],unit]\n",
|
||||
" \n",
|
||||
" list1.append(list2)\n",
|
||||
"print(list1)\n",
|
||||
"filename = 'data/天津石化体测报告打印明细表(修改).xlsx'\n",
|
||||
"filename = 'data/天津石化体测报告打印明细表(第一批).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
@@ -2631,18 +2647,37 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 87,
|
||||
"id": "006afc6c-2b1f-4edf-be1b-5f60e2029ee8",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-14T05:31:33.869705Z",
|
||||
"iopub.status.busy": "2023-11-14T05:31:33.869187Z",
|
||||
"iopub.status.idle": "2023-11-14T05:31:33.963951Z",
|
||||
"shell.execute_reply": "2023-11-14T05:31:33.963038Z",
|
||||
"shell.execute_reply.started": "2023-11-14T05:31:33.869655Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"0~255分人数:1641人,男性:1334人,女性:307人\n",
|
||||
"256~332分人数:1544人,男性:941人,女性:603人\n",
|
||||
"333~367分人数:354人,男性:191人,女性:163人\n",
|
||||
"368~500分人数:118人,男性:39人,女性:79人\n",
|
||||
"3657\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
"items = ['体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"\n",
|
||||
"filename = 'data/data_天津231017.json'\n",
|
||||
"filename = 'data/data_天津231017_非倒班.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"dict2 = {}\n",
|
||||
@@ -2679,12 +2714,34 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 88,
|
||||
"id": "949e4c3c-023d-44a4-b99e-c5460da61161",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-14T05:32:00.827469Z",
|
||||
"iopub.status.busy": "2023-11-14T05:32:00.826734Z",
|
||||
"iopub.status.idle": "2023-11-14T05:32:00.923421Z",
|
||||
"shell.execute_reply": "2023-11-14T05:32:00.922591Z",
|
||||
"shell.execute_reply.started": "2023-11-14T05:32:00.827429Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"20~24岁平均成绩:2.45分,人数:581人,男性:384人\n",
|
||||
"25~29岁平均成绩:2.56分,人数:369人,男性:252人\n",
|
||||
"30~34岁平均成绩:2.56分,人数:211人,男性:144人\n",
|
||||
"35~39岁平均成绩:2.67分,人数:414人,男性:281人\n",
|
||||
"40~44岁平均成绩:2.7分,人数:318人,男性:188人\n",
|
||||
"45~49岁平均成绩:2.71分,人数:563人,男性:310人\n",
|
||||
"50~54岁平均成绩:2.63分,人数:849人,男性:594人\n",
|
||||
"55~69岁平均成绩:2.46分,人数:352人,男性:352人\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,69]]\n",
|
||||
"\n",
|
||||
@@ -2717,12 +2774,34 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 86,
|
||||
"id": "721977d3-5816-4bf6-82fc-26fd170e5454",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-14T05:29:45.231085Z",
|
||||
"iopub.status.busy": "2023-11-14T05:29:45.230706Z",
|
||||
"iopub.status.idle": "2023-11-14T05:29:45.291777Z",
|
||||
"shell.execute_reply": "2023-11-14T05:29:45.290397Z",
|
||||
"shell.execute_reply.started": "2023-11-14T05:29:45.231052Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"20~24岁平均成绩:2.42分,人数:322人\n",
|
||||
"25~29岁平均成绩:2.54分,人数:120人\n",
|
||||
"30~34岁平均成绩:2.61分,人数:21人\n",
|
||||
"35~39岁平均成绩:2.23分,人数:47人\n",
|
||||
"40~44岁平均成绩:2.46分,人数:57人\n",
|
||||
"45~49岁平均成绩:2.4分,人数:156人\n",
|
||||
"50~54岁平均成绩:2.39分,人数:335人\n",
|
||||
"55~80岁平均成绩:2.5分,人数:225人\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -2795,12 +2874,29 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 90,
|
||||
"id": "7155f2c2-0719-4558-aa3b-629fb70194d6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-14T05:32:38.731026Z",
|
||||
"iopub.status.busy": "2023-11-14T05:32:38.730664Z",
|
||||
"iopub.status.idle": "2023-11-14T05:32:38.802327Z",
|
||||
"shell.execute_reply": "2023-11-14T05:32:38.801563Z",
|
||||
"shell.execute_reply.started": "2023-11-14T05:32:38.730994Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"平均成绩:2.4823分,男性:2505人\n",
|
||||
"平均成绩:2.8604分,女性:1152人\n",
|
||||
"平均成绩:2.6014分,总体:3657人\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -2826,7 +2922,7 @@
|
||||
" score = score+v['score']\n",
|
||||
"print(f'平均成绩:{round(score/f,4)}分,女性:{f}人')\n",
|
||||
"t_score = t_score + score\n",
|
||||
"print(f'平均成绩:{round(t_score/5383,4)}分,总体:5383人')"
|
||||
"print(f'平均成绩:{round(t_score/3657,4)}分,总体:3657人')"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -2925,6 +3021,60 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "194217e0-f1cf-4945-ad5a-52304ed2f943",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 计算各项目成绩"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 91,
|
||||
"id": "5ed284c6-1a1c-43ab-92a8-b3c411cd77a1",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-14T05:34:30.789468Z",
|
||||
"iopub.status.busy": "2023-11-14T05:34:30.789112Z",
|
||||
"iopub.status.idle": "2023-11-14T05:34:30.903912Z",
|
||||
"shell.execute_reply": "2023-11-14T05:34:30.903118Z",
|
||||
"shell.execute_reply.started": "2023-11-14T05:34:30.789436Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"BMI 3.54 3634\n",
|
||||
"肺活量 3.37 3569\n",
|
||||
"握力 1.29 3592\n",
|
||||
"坐位体前屈 2.85 3142\n",
|
||||
"纵跳 2.0 3198\n",
|
||||
"俯卧撑 2.57 2082\n",
|
||||
"一分钟仰卧起坐 3.94 757\n",
|
||||
"单脚站立 2.01 3523\n",
|
||||
"选择反应时 2.97 3613\n",
|
||||
"台阶指数 2.58 1496\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"items = ['BMI','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||
"for item in items:\n",
|
||||
" score = 0\n",
|
||||
" n = 0\n",
|
||||
" for k, v in dict1.items(): \n",
|
||||
" if item in v['fits'].keys():\n",
|
||||
" n = n + 1\n",
|
||||
" score =score + int(v['fits'][item]['score'])\n",
|
||||
" print(item,round(score/n,2),n)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5a130857-4dd1-4b5e-b21b-42fe32b367cf",
|
||||
@@ -3101,15 +3251,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 253,
|
||||
"execution_count": 80,
|
||||
"id": "518a1e40-d383-4d78-a4ea-224ddab49b79",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-11-10T13:59:53.477003Z",
|
||||
"iopub.status.busy": "2023-11-10T13:59:53.476599Z",
|
||||
"iopub.status.idle": "2023-11-10T13:59:54.275449Z",
|
||||
"shell.execute_reply": "2023-11-10T13:59:54.274890Z",
|
||||
"shell.execute_reply.started": "2023-11-10T13:59:53.476972Z"
|
||||
"iopub.execute_input": "2023-11-14T04:54:34.744376Z",
|
||||
"iopub.status.busy": "2023-11-14T04:54:34.744069Z",
|
||||
"iopub.status.idle": "2023-11-14T04:54:36.013106Z",
|
||||
"shell.execute_reply": "2023-11-14T04:54:36.012373Z",
|
||||
"shell.execute_reply.started": "2023-11-14T04:54:34.744349Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
@@ -3118,7 +3268,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"1726\n"
|
||||
"3657\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -3137,19 +3287,73 @@
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"dict2 = {}\n",
|
||||
"i = 1\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
"for n in range(4, sheet.max_row+1):\n",
|
||||
" if sheet.cell(n, 1).value is not None:\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" daoban = sheet.cell(n, 6).value\n",
|
||||
" if str(code) in dict1.keys() and daoban == '倒班':\n",
|
||||
" dict2[str(code)] = dict1[str(code)]\n",
|
||||
"print(len(dict2))"
|
||||
"filename = 'data/data_天津231017_倒班.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict2, fl) \n",
|
||||
"dict3 = {}\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" if k not in dict2.keys():\n",
|
||||
" dict3[k] = dict1[k]\n",
|
||||
"print(len(dict3))\n",
|
||||
" \n",
|
||||
"filename = 'data/data_天津231017_非倒班.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict3, fl) \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "cf45ba36-896d-4d28-ae4a-08c512ff1ddb",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 核对倒班员工信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "08167b05-8719-41c9-a71d-57906a55eb63",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/data_天津231017.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"wb = openpyxl.load_workbook('data/员工个人基础信息-倒班.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"dict2 = {}\n",
|
||||
"i = 0\n",
|
||||
"for n in range(4, sheet.max_row+1):\n",
|
||||
" if sheet.cell(n, 1).value is not None:\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" daoban = sheet.cell(n, 6).value\n",
|
||||
" if str(code) in dict1.keys():# and daoban != '倒班':\n",
|
||||
" dict2[str(code)] = dict1[str(code)]\n",
|
||||
"for k,v in dict1.items():\n",
|
||||
" if str(k) not in dict2.keys():\n",
|
||||
" i+=1\n",
|
||||
" print(i,k,v['name'])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "54b2abad-9891-4e06-93b7-ca5c0659ea49",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user