This commit is contained in:
512song committed 2023-09-20 20:10:12 +08:00
1 parent de5294b214
commit b7dabe4171
1 file changed
+38 -38
+38 -38
View File
@@ -1505,15 +1505,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 40,
"id": "25283932-c03a-4a34-a59d-314fc64d8fbd", "id": "25283932-c03a-4a34-a59d-314fc64d8fbd",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-09-19T09:55:56.717650Z", "iopub.execute_input": "2023-09-20T10:10:02.758922Z",
"iopub.status.busy": "2023-09-19T09:55:56.717215Z", "iopub.status.busy": "2023-09-20T10:10:02.758473Z",
"iopub.status.idle": "2023-09-19T09:55:57.413548Z", "iopub.status.idle": "2023-09-20T10:10:03.499992Z",
"shell.execute_reply": "2023-09-19T09:55:57.413082Z", "shell.execute_reply": "2023-09-20T10:10:03.499518Z",
"shell.execute_reply.started": "2023-09-19T09:55:56.717617Z" "shell.execute_reply.started": "2023-09-20T10:10:02.758886Z"
}, },
"tags": [] "tags": []
}, },
@@ -1600,15 +1600,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 42,
"id": "e26b88fc-c75b-4c1e-82ea-5017370afa9b", "id": "e26b88fc-c75b-4c1e-82ea-5017370afa9b",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-09-19T09:56:00.774430Z", "iopub.execute_input": "2023-09-20T10:12:15.164390Z",
"iopub.status.busy": "2023-09-19T09:56:00.774175Z", "iopub.status.busy": "2023-09-20T10:12:15.163888Z",
"iopub.status.idle": "2023-09-19T09:56:00.815234Z", "iopub.status.idle": "2023-09-20T10:12:15.331894Z",
"shell.execute_reply": "2023-09-19T09:56:00.814836Z", "shell.execute_reply": "2023-09-20T10:12:15.331424Z",
"shell.execute_reply.started": "2023-09-19T09:56:00.774414Z" "shell.execute_reply.started": "2023-09-20T10:12:15.164354Z"
}, },
"tags": [] "tags": []
}, },
@@ -1617,8 +1617,8 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"548\n", "891\n",
"548\n" "891\n"
] ]
} }
], ],
@@ -1641,7 +1641,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/places_result_20230919.csv'\n", "filename = 'data/places_result_20230920.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",
@@ -1680,15 +1680,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 43,
"id": "0a6ea33d-c112-4ed8-9366-3376e55a5731", "id": "0a6ea33d-c112-4ed8-9366-3376e55a5731",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-09-19T09:56:14.365981Z", "iopub.execute_input": "2023-09-20T10:15:10.009585Z",
"iopub.status.busy": "2023-09-19T09:56:14.365507Z", "iopub.status.busy": "2023-09-20T10:15:10.009190Z",
"iopub.status.idle": "2023-09-19T09:56:14.524260Z", "iopub.status.idle": "2023-09-20T10:15:10.258788Z",
"shell.execute_reply": "2023-09-19T09:56:14.523770Z", "shell.execute_reply": "2023-09-20T10:15:10.258306Z",
"shell.execute_reply.started": "2023-09-19T09:56:14.365945Z" "shell.execute_reply.started": "2023-09-20T10:15:10.009553Z"
}, },
"tags": [] "tags": []
}, },
@@ -1724,7 +1724,7 @@
" else:\n", " else:\n",
" list2.append('') \n", " list2.append('') \n",
" list1.append(list2)\n", " list1.append(list2)\n",
"filename = 'data/天津石化体测情况(截至20230919).xlsx'\n", "filename = 'data/天津石化体测情况(截至20230920).xlsx'\n",
"wb = openpyxl.Workbook()\n", "wb = openpyxl.Workbook()\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"sheet.append(title)\n", "sheet.append(title)\n",
@@ -1744,15 +1744,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": 47,
"id": "589a5d44-605d-41a1-a981-7ec7258305ed", "id": "589a5d44-605d-41a1-a981-7ec7258305ed",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-09-19T10:14:32.330635Z", "iopub.execute_input": "2023-09-20T10:20:29.348632Z",
"iopub.status.busy": "2023-09-19T10:14:32.330164Z", "iopub.status.busy": "2023-09-20T10:20:29.348164Z",
"iopub.status.idle": "2023-09-19T10:14:32.413959Z", "iopub.status.idle": "2023-09-20T10:20:29.412315Z",
"shell.execute_reply": "2023-09-19T10:14:32.412831Z", "shell.execute_reply": "2023-09-20T10:20:29.411103Z",
"shell.execute_reply.started": "2023-09-19T10:14:32.330599Z" "shell.execute_reply.started": "2023-09-20T10:20:29.348596Z"
}, },
"tags": [] "tags": []
}, },
@@ -1771,25 +1771,25 @@
"dict3 = {}\n", "dict3 = {}\n",
"for k, v in dict2.items():\n", "for k, v in dict2.items():\n",
" unit = v['unit']\n", " unit = v['unit']\n",
" sub_unit = v['sub_unit']\n", " #sub_unit = v['sub_unit']\n",
" dict3.setdefault(unit,{})\n", " dict3.setdefault(unit,{})\n",
" #dict3[unit].setdefault('人数',0)\n", " dict3[unit].setdefault('人数',0)\n",
" dict3[unit].setdefault(sub_unit,0)\n", " #dict3[unit].setdefault(sub_unit,0)\n",
" dict3[unit][sub_unit] = dict3[unit][sub_unit] + 1\n", " #dict3[unit][sub_unit] = dict3[unit][sub_unit] + 1\n",
" #dict3[unit]['人数'] = dict3[unit]['人数'] + 1\n", " dict3[unit]['人数'] = dict3[unit]['人数'] + 1\n",
"\n", "\n",
"title =['单位','体测人数']\n", "title =['单位','体测人数']\n",
"list1 = []\n", "list1 = []\n",
"for k,v in dict1.items(): \n", "for k,v in dict1.items(): \n",
" unit = v['unit']\n", " unit = v['unit']\n",
" sub_unit = v['sub_unit']\n", " #sub_unit = v['sub_unit']\n",
" dict3[unit][sub_unit] = dict3[unit][sub_unit] - 1\n", " #dict3[unit][sub_unit] = dict3[unit][sub_unit] - 1\n",
" dict3[unit]['人数'] = dict3[unit]['人数'] - 1\n",
"for k, v in dict3.items():\n", "for k, v in dict3.items():\n",
" for k1, v1 in v.items():\n", " list2 = [k,v['人数']]\n",
" list2 = [k,k1,v1]\n",
" list1.append(list2)\n", " list1.append(list2)\n",
"\n", "\n",
"filename = 'data/天津部门未测试情况(截至20230919).xlsx'\n", "filename = 'data/天津部门未测试情况(截至20230920).xlsx'\n",
"wb = openpyxl.Workbook()\n", "wb = openpyxl.Workbook()\n",
"sheet = wb.active\n", "sheet = wb.active\n",
"sheet.append(title)\n", "sheet.append(title)\n",