20220812
This commit is contained in:
1 parent
f0667bdb25
commit
f463c8d49a
2 files changed
+145
-67
No files matched your search
@@ -26,32 +26,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"id": "1f58bd08-d20b-4a76-a841-ac7e132a54b7",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-08-05T05:39:03.670486Z",
|
||||
"iopub.status.busy": "2022-08-05T05:39:03.669966Z",
|
||||
"iopub.status.idle": "2022-08-05T05:39:03.705022Z",
|
||||
"shell.execute_reply": "2022-08-05T05:39:03.703508Z",
|
||||
"shell.execute_reply.started": "2022-08-05T05:39:03.670438Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import re\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"file_name = 'data/132.txt'\n",
|
||||
"file_name = 'data/130.txt'\n",
|
||||
"list1 =[]\n",
|
||||
"dict1 = {}\n",
|
||||
"with open(file_name,'r') as fl:\n",
|
||||
@@ -61,16 +46,148 @@
|
||||
" list2 = l.split(',')\n",
|
||||
" if list2[0] != '' and list2[5] != '':\n",
|
||||
" dict1[list2[0]] = [list2[1],list2[2],list2[3],list2[4],list2[5]+list2[6]]\n",
|
||||
"filename = 'data/132中医体质.json'\n",
|
||||
"filename = 'data/130中医体质.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl) \n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a0f172a9-a0f3-4d53-90f0-39dda318c59b",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 测试人员分类"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "400f6c4b-8a67-4872-a912-a0aad86e923c",
|
||||
"id": "e83b31a6-4fae-40be-8159-fd509999c6d5",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"filename = 'data/交警支队完成情况.xlsx'\n",
|
||||
"wb = openpyxl.load_workbook(filename)\n",
|
||||
"sheet = wb.active\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
" bh = sheet.cell(n, 1).value\n",
|
||||
" xm = sheet.cell(n, 3).value\n",
|
||||
" if sheet.cell(n,8).value is not None:\n",
|
||||
" dict1.setdefault('1', [])\n",
|
||||
" dict1['1'].append(bh) \n",
|
||||
" elif sheet.cell(n,8).value is None and sheet.cell(n,6).value is not None:\n",
|
||||
" dict1.setdefault('2', [])\n",
|
||||
" dict1['2'].append(bh)\n",
|
||||
" elif sheet.cell(n,8).value is None and sheet.cell(n,6).value is None and sheet.cell(n,7).value is not None:\n",
|
||||
" dict1.setdefault('3', [])\n",
|
||||
" dict1['3'].append(bh)\n",
|
||||
"filename = 'data/交警支队完成人员分类.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl) \n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "566b134f-03ac-4f79-994e-f4a512d9e5f1",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 生成测试人员分类表"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"id": "1d0c8452-c3ac-4901-83cf-cefdeebee956",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-08-12T01:54:03.835733Z",
|
||||
"iopub.status.busy": "2022-08-12T01:54:03.835180Z",
|
||||
"iopub.status.idle": "2022-08-12T01:54:04.266745Z",
|
||||
"shell.execute_reply": "2022-08-12T01:54:04.265693Z",
|
||||
"shell.execute_reply.started": "2022-08-12T01:54:03.835686Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"filename = 'data/交警支队成绩.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",
|
||||
" dict1[line[0]] = line\n",
|
||||
"filename = 'data/交警支队分组.xlsx'\n",
|
||||
"wb = openpyxl.load_workbook(filename)\n",
|
||||
"\n",
|
||||
"fl_name = 'data/交警支队完成人员分类.json'\n",
|
||||
"with open(fl_name,'r') as fl:\n",
|
||||
" m_xx = json.load(fl)\n",
|
||||
"for k, v in m_xx.items():\n",
|
||||
" if k == '1':\n",
|
||||
" sheet = wb['参加中医体质人员']\n",
|
||||
" i = 2\n",
|
||||
" for item in v:\n",
|
||||
" bh = str(item) \n",
|
||||
" sheet[f'A{i}'] = dict1[bh][4]\n",
|
||||
" sheet[f'B{i}'] = dict1[bh][1]\n",
|
||||
" sheet[f'C{i}'] = dict1[bh][2]\n",
|
||||
" sheet[f'D{i}'] = dict1[bh][3]\n",
|
||||
" sheet[f'E{i}'] = dict1[bh][26]\n",
|
||||
" sheet[f'F{i}'] = dict1[bh][27]\n",
|
||||
" i+=1\n",
|
||||
" elif k == '2':\n",
|
||||
" sheet = wb['参加体测未参加中医体测']\n",
|
||||
" i = 2\n",
|
||||
" for item in v:\n",
|
||||
" bh = str(item)\n",
|
||||
" list1 = dict1[bh]\n",
|
||||
" for n in range(26):\n",
|
||||
" sheet.cell(column = n+1, row=i, value=list1[n])\n",
|
||||
" i+=1\n",
|
||||
" else:\n",
|
||||
" sheet = wb['只参加心理未参加中医']\n",
|
||||
" i = 2\n",
|
||||
" for item in v:\n",
|
||||
" bh = str(item)\n",
|
||||
" sheet[f'A{i}'] = bh\n",
|
||||
" sheet[f'B{i}'] = dict1[bh][4]\n",
|
||||
" sheet[f'C{i}'] = dict1[bh][1]\n",
|
||||
" sheet[f'D{i}'] = dict1[bh][2]\n",
|
||||
" sheet[f'E{i}'] = dict1[bh][3]\n",
|
||||
" list1 = dict1[bh]\n",
|
||||
" for n in range(6,16):\n",
|
||||
" sheet.cell(column = n, row=i, value=list1[31+n])\n",
|
||||
" i+=1 \n",
|
||||
" \n",
|
||||
"wb.save('data/交警支队分组1.xlsx') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "56998dde-2263-46f1-b315-75be8488ece1",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 人员手机号码核对"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c897d05b-6e6a-46f0-897f-7ec670aba0a0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user