20240929
This commit is contained in:
1 parent
3a9cb48f1e
commit
c03192efe5
3 files changed
+198
-16
No files matched your search
+159
-2
@@ -1,5 +1,13 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "b6ce4321-f82a-4d9d-a110-44a23b95970b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 2023年体质检测"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "28695364-38de-442e-818d-cfab45902763",
|
||||
@@ -840,10 +848,159 @@
|
||||
"print(data)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d3649684-3eab-49ad-8b3d-ebb452289e51",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# 2024年体质检测"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a3f5f78e-6785-48e6-b2b6-b91b8d2aa4ca",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 导入人员信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "096e2b97-b83c-46bb-a070-c816e47da331",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-26T08:13:44.536115Z",
|
||||
"iopub.status.busy": "2024-09-26T08:13:44.535333Z",
|
||||
"iopub.status.idle": "2024-09-26T08:13:44.828454Z",
|
||||
"shell.execute_reply": "2024-09-26T08:13:44.827938Z",
|
||||
"shell.execute_reply.started": "2024-09-26T08:13:44.536043Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/东营石油工程设计公司(2024).xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" if sheet.cell(n,1).value is not None:\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 4).value\n",
|
||||
" dict1['unit'] = sheet.cell(n, 2).value\n",
|
||||
" if sheet.cell(n, 5).value is not None:\n",
|
||||
" dict1['gh'] = sheet.cell(n, 7).value\n",
|
||||
" #dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0] \n",
|
||||
" if sheet.cell(n, 4).value is not None:\n",
|
||||
" dict1['phone'] = str(sheet.cell(n,6).value)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/东营工程设计院2024.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "926e4dc3-fe7a-4b8b-9330-5a9eebc8a766",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 获取人员测试成绩(新格式)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "28afeee6-43c0-4e96-b3aa-dc09c6288425",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-26T08:18:32.261817Z",
|
||||
"iopub.status.busy": "2024-09-26T08:18:32.261244Z",
|
||||
"iopub.status.idle": "2024-09-26T08:18:32.276332Z",
|
||||
"shell.execute_reply": "2024-09-26T08:18:32.275838Z",
|
||||
"shell.execute_reply.started": "2024-09-26T08:18:32.261764Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"75\n",
|
||||
"75\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/东营工程设计院2024.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20240926.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",
|
||||
" #re_ta[user]['sub_unit'] = dict1[user]['sub_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_东营工程设计院2024.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": "code",
|
||||
"execution_count": null,
|
||||
"id": "c5ef31b6-ceed-4167-bec7-58e92b3698e1",
|
||||
"id": "cef2ced9-2cd1-4632-8fe6-6a5a57e2fcb3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
@@ -865,7 +1022,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.12"
|
||||
"version": "3.12.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
+7
-7
@@ -1115,15 +1115,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 62,
|
||||
"execution_count": 101,
|
||||
"id": "cccc2e43-7a73-48ec-8540-06b4d59f8ceb",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-22T11:06:13.897106Z",
|
||||
"iopub.status.busy": "2024-09-22T11:06:13.896366Z",
|
||||
"iopub.status.idle": "2024-09-22T11:06:13.985127Z",
|
||||
"shell.execute_reply": "2024-09-22T11:06:13.984566Z",
|
||||
"shell.execute_reply.started": "2024-09-22T11:06:13.897035Z"
|
||||
"iopub.execute_input": "2024-09-25T07:48:05.301620Z",
|
||||
"iopub.status.busy": "2024-09-25T07:48:05.301088Z",
|
||||
"iopub.status.idle": "2024-09-25T07:48:05.386752Z",
|
||||
"shell.execute_reply": "2024-09-25T07:48:05.386215Z",
|
||||
"shell.execute_reply.started": "2024-09-25T07:48:05.301569Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -1141,7 +1141,7 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"filename = 'data/result_镇海2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
"with open(filename,'r',encoding = 'utf-8') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
" \n",
|
||||
|
||||
+32
-7
@@ -2367,10 +2367,27 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "1e2d586e-6ff5-4fd1-a909-278d23e54561",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-29T02:18:02.228980Z",
|
||||
"iopub.status.busy": "2024-09-29T02:18:02.228201Z",
|
||||
"iopub.status.idle": "2024-09-29T02:18:02.253056Z",
|
||||
"shell.execute_reply": "2024-09-29T02:18:02.252599Z",
|
||||
"shell.execute_reply.started": "2024-09-29T02:18:02.228910Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"80\n",
|
||||
"80\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
@@ -2390,7 +2407,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20240705.csv'\n",
|
||||
"filename = 'data/places_result_20240929.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -2428,9 +2445,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"id": "64c6e1e3-801c-4573-b78f-5a9e842597a9",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-29T02:18:45.748557Z",
|
||||
"iopub.status.busy": "2024-09-29T02:18:45.748059Z",
|
||||
"iopub.status.idle": "2024-09-29T02:18:45.957948Z",
|
||||
"shell.execute_reply": "2024-09-29T02:18:45.957465Z",
|
||||
"shell.execute_reply.started": "2024-09-29T02:18:45.748511Z"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
@@ -2463,7 +2488,7 @@
|
||||
" else:\n",
|
||||
" list2.append('') \n",
|
||||
" list1.append(list2)\n",
|
||||
"filename = 'data/湖南石化青年体质检测.xlsx'\n",
|
||||
"filename = 'data/湖南石化青年体质检测情况表(20240720).xlsx'\n",
|
||||
"wb = openpyxl.Workbook()\n",
|
||||
"sheet = wb.active\n",
|
||||
"sheet.append(title)\n",
|
||||
|
||||
Reference in new issue
Block a user