This commit is contained in:
512song committed 2023-10-25 08:16:19 +00:00
1 parent ceda991559
commit ce3d665870
1 file changed
+71 -26
+71 -26
View File
@@ -656,15 +656,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 71, "execution_count": 98,
"id": "648d597d-2ac4-470c-9562-271e3e2863d6", "id": "648d597d-2ac4-470c-9562-271e3e2863d6",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-10-25T07:27:22.517401Z", "iopub.execute_input": "2023-10-25T08:13:47.536294Z",
"iopub.status.busy": "2023-10-25T07:27:22.517103Z", "iopub.status.busy": "2023-10-25T08:13:47.535980Z",
"iopub.status.idle": "2023-10-25T07:27:22.818722Z", "iopub.status.idle": "2023-10-25T08:13:47.835840Z",
"shell.execute_reply": "2023-10-25T07:27:22.818086Z", "shell.execute_reply": "2023-10-25T08:13:47.835233Z",
"shell.execute_reply.started": "2023-10-25T07:27:22.517373Z" "shell.execute_reply.started": "2023-10-25T08:13:47.536267Z"
}, },
"tags": [] "tags": []
}, },
@@ -869,15 +869,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 76, "execution_count": 101,
"id": "dff13fe9-d5cd-45e3-a3e7-f47d12560699", "id": "dff13fe9-d5cd-45e3-a3e7-f47d12560699",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-10-25T07:39:16.409162Z", "iopub.execute_input": "2023-10-25T08:13:58.275474Z",
"iopub.status.busy": "2023-10-25T07:39:16.408552Z", "iopub.status.busy": "2023-10-25T08:13:58.275157Z",
"iopub.status.idle": "2023-10-25T07:39:16.466833Z", "iopub.status.idle": "2023-10-25T08:13:58.306694Z",
"shell.execute_reply": "2023-10-25T07:39:16.465723Z", "shell.execute_reply": "2023-10-25T08:13:58.305838Z",
"shell.execute_reply.started": "2023-10-25T07:39:16.409106Z" "shell.execute_reply.started": "2023-10-25T08:13:58.275446Z"
}, },
"tags": [] "tags": []
}, },
@@ -928,15 +928,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 72, "execution_count": 99,
"id": "61f8d7c3-b7f2-44b7-86f1-5b29d22193cb", "id": "61f8d7c3-b7f2-44b7-86f1-5b29d22193cb",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-10-25T07:33:25.703931Z", "iopub.execute_input": "2023-10-25T08:13:51.263500Z",
"iopub.status.busy": "2023-10-25T07:33:25.703619Z", "iopub.status.busy": "2023-10-25T08:13:51.263208Z",
"iopub.status.idle": "2023-10-25T07:33:25.762953Z", "iopub.status.idle": "2023-10-25T08:13:51.342292Z",
"shell.execute_reply": "2023-10-25T07:33:25.762254Z", "shell.execute_reply": "2023-10-25T08:13:51.341571Z",
"shell.execute_reply.started": "2023-10-25T07:33:25.703903Z" "shell.execute_reply.started": "2023-10-25T08:13:51.263475Z"
}, },
"tags": [] "tags": []
}, },
@@ -984,15 +984,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 74, "execution_count": 100,
"id": "8da8e47d-b62b-4719-82d5-fcfc61473e08", "id": "8da8e47d-b62b-4719-82d5-fcfc61473e08",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-10-25T07:38:29.475177Z", "iopub.execute_input": "2023-10-25T08:13:54.195888Z",
"iopub.status.busy": "2023-10-25T07:38:29.474849Z", "iopub.status.busy": "2023-10-25T08:13:54.195597Z",
"iopub.status.idle": "2023-10-25T07:38:29.554478Z", "iopub.status.idle": "2023-10-25T08:13:54.261587Z",
"shell.execute_reply": "2023-10-25T07:38:29.553811Z", "shell.execute_reply": "2023-10-25T08:13:54.260957Z",
"shell.execute_reply.started": "2023-10-25T07:38:29.475149Z" "shell.execute_reply.started": "2023-10-25T08:13:54.195864Z"
}, },
"tags": [] "tags": []
}, },
@@ -1019,7 +1019,7 @@
"# sheets = wb.sheetnames\n", "# sheets = wb.sheetnames\n",
"\n", "\n",
"\n", "\n",
"for n in range(3,sheet.max_row+1):\n", "for n in range(5,sheet.max_row+1):\n",
" if sheet.cell(n,1).value is not None:\n", " if sheet.cell(n,1).value is not None:\n",
" code = str(i)\n", " code = str(i)\n",
" person.setdefault(code, {})\n", " person.setdefault(code, {})\n",
@@ -1041,10 +1041,55 @@
"print('ok')\n" "print('ok')\n"
] ]
}, },
{
"cell_type": "markdown",
"id": "3e890abb-5e49-4a80-b401-602cd2e83533",
"metadata": {},
"source": [
"### 人员信息汇总导出"
]
},
{
"cell_type": "code",
"execution_count": 102,
"id": "474786b8-e172-4335-aa4d-bb5bde17ceb7",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-25T08:14:01.457995Z",
"iopub.status.busy": "2023-10-25T08:14:01.457489Z",
"iopub.status.idle": "2023-10-25T08:14:01.591382Z",
"shell.execute_reply": "2023-10-25T08:14:01.590589Z",
"shell.execute_reply.started": "2023-10-25T08:14:01.457949Z"
},
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"filename = 'data/北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"for k, v in dict1.items():\n",
" list2 = []\n",
" list2 = [str(k).rjust(4,'0'),v['name'],v['sex'],v['unit'],v['birth'],v['phone']]\n",
" list1.append(list2)\n",
"filename = 'data/北海炼化人员信息(2023年).xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"\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": "fca6186b-9b4d-4bcd-b5ac-1aecfeb2e149", "id": "0bafbf66-c909-413e-a9c1-c1a5f9c22953",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []