20230918
This commit is contained in:
1 parent
e1da612c61
commit
48cb4d6187
3 files changed
+267
-16
No files matched your search
+5
-3
@@ -152,7 +152,9 @@
|
|||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "4b2b5d76-665f-4dfe-bbd3-5c80abd8c3e3",
|
"id": "4b2b5d76-665f-4dfe-bbd3-5c80abd8c3e3",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from tencentcloud.common import credential\n",
|
"from tencentcloud.common import credential\n",
|
||||||
@@ -181,7 +183,7 @@
|
|||||||
" print('no phone')\n",
|
" print('no phone')\n",
|
||||||
"print(dict2)\n",
|
"print(dict2)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"#dict2 = {375: {'phone': '13793180751', 'code': '0379208'}}\n",
|
||||||
"for k, v in dict2.items():\n",
|
"for k, v in dict2.items():\n",
|
||||||
" phone = '+86'+v['phone']\n",
|
" phone = '+86'+v['phone']\n",
|
||||||
" yzm = v['code']\n",
|
" yzm = v['code']\n",
|
||||||
@@ -207,7 +209,7 @@
|
|||||||
" req.SessionContext = \"\"\n",
|
" req.SessionContext = \"\"\n",
|
||||||
" req.ExtendCode = \"\"\n",
|
" req.ExtendCode = \"\"\n",
|
||||||
" req.SenderId = \"\"\n",
|
" req.SenderId = \"\"\n",
|
||||||
" #resp = client.SendSms(req)\n",
|
" resp = client.SendSms(req)\n",
|
||||||
" dict3 = json.loads(resp.to_json_string(indent=2))\n",
|
" dict3 = json.loads(resp.to_json_string(indent=2))\n",
|
||||||
"\n",
|
"\n",
|
||||||
" print(v['phone'],dict3['SendStatusSet'][0][\"Message\"])\n",
|
" print(v['phone'],dict3['SendStatusSet'][0][\"Message\"])\n",
|
||||||
|
|||||||
+33
-7
@@ -68,12 +68,28 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 3,
|
||||||
"id": "fd73b8be-d3fe-49aa-99d2-3cc6df4a3eb0",
|
"id": "fd73b8be-d3fe-49aa-99d2-3cc6df4a3eb0",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-09-18T02:28:13.173784Z",
|
||||||
|
"iopub.status.busy": "2023-09-18T02:28:13.173377Z",
|
||||||
|
"iopub.status.idle": "2023-09-18T02:28:13.258454Z",
|
||||||
|
"shell.execute_reply": "2023-09-18T02:28:13.257893Z",
|
||||||
|
"shell.execute_reply.started": "2023-09-18T02:28:13.173753Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"523\n",
|
||||||
|
"523\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"import time\n",
|
"import time\n",
|
||||||
@@ -89,11 +105,11 @@
|
|||||||
"re_ta = {}\n",
|
"re_ta = {}\n",
|
||||||
"dict1 = {}\n",
|
"dict1 = {}\n",
|
||||||
"list1 = []\n",
|
"list1 = []\n",
|
||||||
"filename = 'data/北京农行人员名单.json'\n",
|
"filename = 'data/北京农行人员名单all.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",
|
||||||
"filename = 'data/places_result_20230521.csv'\n",
|
"filename = 'data/places_result_20230918.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",
|
||||||
@@ -113,6 +129,7 @@
|
|||||||
" re_ta[user].setdefault(item_name,{}) \n",
|
" re_ta[user].setdefault(item_name,{}) \n",
|
||||||
" 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",
|
||||||
|
" re_ta[user][item_name]['得分'] = result[5]\n",
|
||||||
"print(len(re_ta))\n",
|
"print(len(re_ta))\n",
|
||||||
"filename = 'data/result_北京农行.json'\n",
|
"filename = 'data/result_北京农行.json'\n",
|
||||||
"\n",
|
"\n",
|
||||||
@@ -131,9 +148,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 6,
|
||||||
"id": "b870bd6e-f972-4073-b13d-5fda8cc92bb7",
|
"id": "b870bd6e-f972-4073-b13d-5fda8cc92bb7",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-09-18T02:33:35.544712Z",
|
||||||
|
"iopub.status.busy": "2023-09-18T02:33:35.544319Z",
|
||||||
|
"iopub.status.idle": "2023-09-18T02:33:35.710354Z",
|
||||||
|
"shell.execute_reply": "2023-09-18T02:33:35.709872Z",
|
||||||
|
"shell.execute_reply.started": "2023-09-18T02:33:35.544678Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@@ -148,7 +172,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/北京农行人员名单.json'\n",
|
"filename = 'data/北京农行人员名单all.json'\n",
|
||||||
"with open(filename,'r') as fl:\n",
|
"with open(filename,'r') as fl:\n",
|
||||||
" dict2 = json.load(fl)\n",
|
" dict2 = json.load(fl)\n",
|
||||||
" \n",
|
" \n",
|
||||||
@@ -161,11 +185,13 @@
|
|||||||
" list2.append(dict2[k]['unit'])\n",
|
" list2.append(dict2[k]['unit'])\n",
|
||||||
" for item in items:\n",
|
" for item in items:\n",
|
||||||
" if item in v.keys():\n",
|
" if item in v.keys():\n",
|
||||||
" list2.append(v[item]['成绩']) \n",
|
" list2.append(v[item]['成绩']) \n",
|
||||||
|
" list2.append(v[item]['得分']) \n",
|
||||||
" elif item =='name':\n",
|
" elif item =='name':\n",
|
||||||
" list2.append(v[item])\n",
|
" list2.append(v[item])\n",
|
||||||
" else:\n",
|
" else:\n",
|
||||||
" list2.append('') \n",
|
" list2.append('') \n",
|
||||||
|
" list2.append('') \n",
|
||||||
" list1.append(list2)\n",
|
" list1.append(list2)\n",
|
||||||
"filename = 'data/北京农行体测情况.xlsx'\n",
|
"filename = 'data/北京农行体测情况.xlsx'\n",
|
||||||
"wb = openpyxl.Workbook()\n",
|
"wb = openpyxl.Workbook()\n",
|
||||||
|
|||||||
+229
-6
@@ -4,9 +4,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "e764be85-0ddf-4055-abd6-de2990e75db8",
|
"id": "e764be85-0ddf-4055-abd6-de2990e75db8",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"jp-MarkdownHeadingCollapsed": true,
|
"tags": []
|
||||||
"tags": [],
|
|
||||||
"toc-hr-collapsed": true
|
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"# 第一次体测"
|
"# 第一次体测"
|
||||||
@@ -1506,12 +1504,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 6,
|
||||||
"id": "25283932-c03a-4a34-a59d-314fc64d8fbd",
|
"id": "25283932-c03a-4a34-a59d-314fc64d8fbd",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-09-18T11:07:39.418682Z",
|
||||||
|
"iopub.status.busy": "2023-09-18T11:07:39.418211Z",
|
||||||
|
"iopub.status.idle": "2023-09-18T11:07:40.143672Z",
|
||||||
|
"shell.execute_reply": "2023-09-18T11:07:40.143214Z",
|
||||||
|
"shell.execute_reply.started": "2023-09-18T11:07:39.418645Z"
|
||||||
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"ok\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import openpyxl\n",
|
"import openpyxl\n",
|
||||||
"import json\n",
|
"import json\n",
|
||||||
@@ -1576,10 +1589,220 @@
|
|||||||
"print('ok')"
|
"print('ok')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "60f4831c-b44e-40d2-ad8a-d79079c071f9",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 获取人员测试成绩"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 12,
|
||||||
|
"id": "e26b88fc-c75b-4c1e-82ea-5017370afa9b",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-09-18T11:26:25.004900Z",
|
||||||
|
"iopub.status.busy": "2023-09-18T11:26:25.004403Z",
|
||||||
|
"iopub.status.idle": "2023-09-18T11:26:25.065113Z",
|
||||||
|
"shell.execute_reply": "2023-09-18T11:26:25.064139Z",
|
||||||
|
"shell.execute_reply.started": "2023-09-18T11:26:25.004862Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"184\n",
|
||||||
|
"184\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/天津石化人员名单2023.json'\n",
|
||||||
|
"with open(filename,'r') as fl:\n",
|
||||||
|
" dict1 = json.load(fl) \n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/places_result_20230918.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]['unit'] = dict1[user]['unit']\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",
|
||||||
|
"filename = 'data/result_天津2023.json'\n",
|
||||||
|
"\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": "43bd1127-fa76-4c1e-8890-4bb47b28ecdf",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 导出测试人员信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 10,
|
||||||
|
"id": "0a6ea33d-c112-4ed8-9366-3376e55a5731",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-09-18T11:19:24.311567Z",
|
||||||
|
"iopub.status.busy": "2023-09-18T11:19:24.311099Z",
|
||||||
|
"iopub.status.idle": "2023-09-18T11:19:24.414514Z",
|
||||||
|
"shell.execute_reply": "2023-09-18T11:19:24.414032Z",
|
||||||
|
"shell.execute_reply.started": "2023-09-18T11:19:24.311530Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import openpyxl\n",
|
||||||
|
"\n",
|
||||||
|
"items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||||
|
"title = ['编号','姓名','性别','单位','身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/result_天津2023.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",
|
||||||
|
" 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/天津石化体测情况(截至20230918).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": "4a53db48-365e-4056-8468-bbc829e83682",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 统计各部门测试情况"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 17,
|
||||||
|
"id": "3f47ee9d-e520-4141-9e44-084f61d19590",
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2023-09-18T11:35:14.320583Z",
|
||||||
|
"iopub.status.busy": "2023-09-18T11:35:14.320133Z",
|
||||||
|
"iopub.status.idle": "2023-09-18T11:35:14.372395Z",
|
||||||
|
"shell.execute_reply": "2023-09-18T11:35:14.371056Z",
|
||||||
|
"shell.execute_reply.started": "2023-09-18T11:35:14.320547Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"{'消防支队': 92, '电仪部': 350, '水务部': 441, '烯烃部': 359, '热电部': 498, '炼油部': 1271, '化工部': 608, '运输销售部': 225, '化验计量部': 503, '南港烯烃部': 779, '公司机关': 402, '信息档案管理中心': 70, '装备研究院': 57, '原油储运部': 203, '党委党校(培训中心)': 79, '研究院': 110, '南港乙烯项目管理部': 70, '行政事务中心': 133, '聚醚部': 153, '物资采购中心': 198}\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/result_天津2023.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",
|
||||||
|
"dict3 = {}\n",
|
||||||
|
"for k, v in dict2.items():\n",
|
||||||
|
" unit = v['unit']\n",
|
||||||
|
" dict3.setdefault(unit,0)\n",
|
||||||
|
" dict3[unit] = dict3[unit] + 1\n",
|
||||||
|
"print(dict3)\n",
|
||||||
|
"title =['单位','体测人数']\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"for k,v in dict1.items(): \n",
|
||||||
|
" unit = v['unit']\n",
|
||||||
|
" dict3[unit] = dict3[unit] - 1\n",
|
||||||
|
" \n",
|
||||||
|
"for k, v in dict3.items():\n",
|
||||||
|
" list2 = [k,v]\n",
|
||||||
|
" list1.append(list2)\n",
|
||||||
|
"\n",
|
||||||
|
"filename = 'data/天津部门未测试情况(截至20230918).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",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"id": "fc8fa610-9c61-4baa-a1cc-901aef9f421c",
|
"id": "589a5d44-605d-41a1-a981-7ec7258305ed",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": []
|
"source": []
|
||||||
|
|||||||
Reference in new issue
Block a user