This commit is contained in:
512song@sina.com committed 2023-03-25 21:42:59 +08:00
1 parent b0c6c2db4e
commit 76f6457904
1 file changed
+233 -70
+233 -70
View File
@@ -18,15 +18,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 109,
"id": "9b2b755e-049e-48c5-87d3-dd37dceb59fe", "id": "9b2b755e-049e-48c5-87d3-dd37dceb59fe",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-03-24T13:14:35.940432Z", "iopub.execute_input": "2023-03-25T13:01:16.720629Z",
"iopub.status.busy": "2023-03-24T13:14:35.939897Z", "iopub.status.busy": "2023-03-25T13:01:16.720098Z",
"iopub.status.idle": "2023-03-24T13:14:36.013683Z", "iopub.status.idle": "2023-03-25T13:01:16.793226Z",
"shell.execute_reply": "2023-03-24T13:14:36.012420Z", "shell.execute_reply": "2023-03-25T13:01:16.791845Z",
"shell.execute_reply.started": "2023-03-24T13:14:35.940384Z" "shell.execute_reply.started": "2023-03-25T13:01:16.720582Z"
}, },
"tags": [] "tags": []
}, },
@@ -54,7 +54,7 @@
" dict2[bh] = item\n", " dict2[bh] = item\n",
"filename = 'data/羊庙人员名单.json'\n", "filename = 'data/羊庙人员名单.json'\n",
"with open(filename, 'w') as fl:\n", "with open(filename, 'w') as fl:\n",
" json.dump(dict2, fl, ensure_ascii=False)\n", " json.dump(dict2, fl, ensure_ascii=False,default=str)\n",
"print('ok')" "print('ok')"
] ]
}, },
@@ -68,15 +68,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 86, "execution_count": 106,
"id": "d89e0e5e-0782-40a3-bba3-862cc9865d4e", "id": "d89e0e5e-0782-40a3-bba3-862cc9865d4e",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-03-25T03:42:53.495948Z", "iopub.execute_input": "2023-03-25T12:53:20.720371Z",
"iopub.status.busy": "2023-03-25T03:42:53.495372Z", "iopub.status.busy": "2023-03-25T12:53:20.719832Z",
"iopub.status.idle": "2023-03-25T03:42:53.531455Z", "iopub.status.idle": "2023-03-25T12:53:20.755754Z",
"shell.execute_reply": "2023-03-25T03:42:53.530000Z", "shell.execute_reply": "2023-03-25T12:53:20.754239Z",
"shell.execute_reply.started": "2023-03-25T03:42:53.495901Z" "shell.execute_reply.started": "2023-03-25T12:53:20.720324Z"
}, },
"tags": [] "tags": []
}, },
@@ -131,15 +131,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 63, "execution_count": 110,
"id": "e76837e8-cdf4-41e0-9d51-6ae5223de813", "id": "e76837e8-cdf4-41e0-9d51-6ae5223de813",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-03-24T14:43:32.834711Z", "iopub.execute_input": "2023-03-25T13:01:26.806474Z",
"iopub.status.busy": "2023-03-24T14:43:32.834163Z", "iopub.status.busy": "2023-03-25T13:01:26.805933Z",
"iopub.status.idle": "2023-03-24T14:43:32.955657Z", "iopub.status.idle": "2023-03-25T13:01:26.931144Z",
"shell.execute_reply": "2023-03-24T14:43:32.954341Z", "shell.execute_reply": "2023-03-25T13:01:26.929813Z",
"shell.execute_reply.started": "2023-03-24T14:43:32.834663Z" "shell.execute_reply.started": "2023-03-25T13:01:26.806426Z"
}, },
"tags": [] "tags": []
}, },
@@ -173,7 +173,7 @@
" if sheet.cell(n, 9).value is not None:\n", " if sheet.cell(n, 9).value is not None:\n",
" dict1['birth'] = str(sheet.cell(n, 9).value).split(' ')[0]\n", " dict1['birth'] = str(sheet.cell(n, 9).value).split(' ')[0]\n",
" if sheet.cell(n, 10).value is not None:\n", " if sheet.cell(n, 10).value is not None:\n",
" dict1['phone'] = sheet.cell(n, 10).value\n", " dict1['phone'] = str(sheet.cell(n, 10).value)\n",
" if sheet.cell(n,11).value is not None:\n", " if sheet.cell(n,11).value is not None:\n",
" dict1['id_num'] = sheet.cell(n,11).value\n", " dict1['id_num'] = sheet.cell(n,11).value\n",
" person[code] = dict1\n", " person[code] = dict1\n",
@@ -194,16 +194,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 111,
"id": "1293cdaa-1fdf-43a5-99ce-a031a76f6688", "id": "1293cdaa-1fdf-43a5-99ce-a031a76f6688",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-03-24T14:42:34.578240Z", "iopub.execute_input": "2023-03-25T13:01:43.947501Z",
"iopub.status.busy": "2023-03-24T14:42:34.577707Z", "iopub.status.busy": "2023-03-25T13:01:43.946930Z",
"iopub.status.idle": "2023-03-24T14:42:35.818413Z", "iopub.status.idle": "2023-03-25T13:01:45.320648Z",
"shell.execute_reply": "2023-03-24T14:42:35.816872Z", "shell.execute_reply": "2023-03-25T13:01:45.319280Z",
"shell.execute_reply.started": "2023-03-24T14:42:34.578193Z" "shell.execute_reply.started": "2023-03-25T13:01:43.947454Z"
} },
"tags": []
}, },
"outputs": [ "outputs": [
{ {
@@ -231,10 +232,13 @@
" name = sheet.cell(n, 5).value\n", " name = sheet.cell(n, 5).value\n",
" dict1['name'] = name\n", " dict1['name'] = name\n",
" dict1['bh'] = n - 1\n", " dict1['bh'] = n - 1\n",
" dict1['sex'] = sheet.cell(n, 6).value\n",
" if sheet.cell(n, 9).value is not None:\n", " if sheet.cell(n, 9).value is not None:\n",
" dict1['phone'] = sheet.cell(n, 9).value\n", " dict1['phone'] = str(sheet.cell(n, 9).value)\n",
" if sheet.cell(n,8).value is not None:\n", " if sheet.cell(n,8).value is not None:\n",
" dict1['id_num'] = sheet.cell(n,8).value\n", " dict1['id_num'] = sheet.cell(n,8).value\n",
" if sheet.cell(n,3).value is not None:\n",
" dict1['unit'] = sheet.cell(n,3).value\n",
" person[code] = dict1\n", " person[code] = dict1\n",
"print(len(person))\n", "print(len(person))\n",
"filename = 'data/杨庙恢复版信息.json'\n", "filename = 'data/杨庙恢复版信息.json'\n",
@@ -253,15 +257,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 92, "execution_count": 112,
"id": "f21fff31-0da6-4c1a-bf7c-8c4a1d4a3ecf", "id": "f21fff31-0da6-4c1a-bf7c-8c4a1d4a3ecf",
"metadata": { "metadata": {
"execution": { "execution": {
"iopub.execute_input": "2023-03-25T03:53:57.819611Z", "iopub.execute_input": "2023-03-25T13:01:54.814448Z",
"iopub.status.busy": "2023-03-25T03:53:57.819079Z", "iopub.status.busy": "2023-03-25T13:01:54.813880Z",
"iopub.status.idle": "2023-03-25T03:53:57.862720Z", "iopub.status.idle": "2023-03-25T13:01:54.856798Z",
"shell.execute_reply": "2023-03-25T03:53:57.861589Z", "shell.execute_reply": "2023-03-25T13:01:54.855640Z",
"shell.execute_reply.started": "2023-03-25T03:53:57.819563Z" "shell.execute_reply.started": "2023-03-25T13:01:54.814400Z"
}, },
"tags": [] "tags": []
}, },
@@ -345,6 +349,144 @@
" print(item)" " print(item)"
] ]
}, },
{
"cell_type": "markdown",
"id": "b08187a6-41d9-40ec-bc62-d99969148fe7",
"metadata": {},
"source": [
"## 补充恢复版信息"
]
},
{
"cell_type": "code",
"execution_count": 126,
"id": "50a5e0f9-3850-48ac-9f3a-f5a7be51a7fd",
"metadata": {
"execution": {
"iopub.execute_input": "2023-03-25T13:36:31.137236Z",
"iopub.status.busy": "2023-03-25T13:36:31.136695Z",
"iopub.status.idle": "2023-03-25T13:36:31.342725Z",
"shell.execute_reply": "2023-03-25T13:36:31.341445Z",
"shell.execute_reply.started": "2023-03-25T13:36:31.137189Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"438\n",
"1 98776 唐庆振\n",
"2 398 黄志全\n",
"3 388 施怡如\n",
"4 98767 张莉\n",
"5 98766 张爱芹\n",
"6 367 李树强\n",
"7 339 刘俊英\n",
"8 338 刘树训\n",
"9 98765 张红霞\n",
"10 314 不详\n",
"11 313 王祝娥\n",
"12 312 赵芝堂\n",
"13 311 吕秀英\n",
"14 308 刘玉娥\n",
"15 307 程潍芳\n",
"16 305 韩春光\n",
"17 304 赵娥\n",
"18 299 盖彦玮\n",
"19 288 盖汝亭\n",
"20 280 柯天新\n",
"21 247 程华英\n",
"22 246 郭俊敏\n",
"23 244 罗桂贤\n",
"24 235 胡巧英\n",
"25 232 许义田\n",
"26 230 韩红华\n",
"27 226 杨秀荣\n",
"28 223 樊风亭\n",
"29 218 程玉良\n",
"30 213 张金宗\n",
"31 208 王小冬\n",
"32 200 李勇军\n",
"33 196 王连秀\n",
"34 188 杨志敏\n",
"35 151 许海仙\n",
"36 149 盖梦娜\n",
"37 148 冯静静\n",
"38 147 王海方\n",
"39 145 裴\n",
"40 136 刘兆合\n",
"41 134 张荣俊\n",
"42 120 郑凤\n",
"43 114 许建玲\n",
"44 103 不详\n",
"45 102 孙海莹\n",
"46 99 周\n",
"47 90 刘桂英\n",
"48 89 石云贞\n",
"49 80 刘凤英\n",
"50 74 李若梅\n",
"51 65 许秀凤\n",
"52 64 刘小凤\n",
"53 62 吕吉刚\n",
"54 60 盖\n",
"55 47 王其美\n",
"56 38 罗炳顺\n",
"57 35 藏学亮\n",
"58 34 胡世杰\n",
"59 29 盖叔臣\n",
"60 21 黄雯青\n",
"61 16 王金花\n",
"62 14 石立华\n",
"ok\n"
]
}
],
"source": [
"filename = 'data/杨庙恢复版信息.json'\n",
"with open(filename,'r') as fl:\n",
" dict_base = json.load(fl)\n",
"for k, v in dict_base.items():\n",
" set1.add(int(k))\n",
"filename = 'data/杨庙运动风险筛查统计表信息.json'\n",
"\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"for k,v in dict_base.items():\n",
" if k in dict1.keys() and 'phone' not in v.keys() and 'phone' in dict1[k].keys():\n",
" #print(k,v['name'])\n",
" dict_base[k]['phone'] = dict1[k]['phone']\n",
"\n",
"for k, v in dict1.items():\n",
" if int(k) in list2 and k not in dict_base.keys():\n",
" dict_base[k] = v\n",
" \n",
"print(len(dict_base))\n",
"#print(dict_base)\n",
"filename = 'data/羊庙人员名单.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"i = 1\n",
"for k, v in dict_base.items():\n",
" if 'bh' not in v.keys():\n",
" name = v['name']\n",
" n = 0\n",
" for k1,v1 in dict2.items():\n",
" if name == v1['name']:\n",
" bh = k1\n",
" n = n+1\n",
" if n ==1:\n",
" dict_base[k]['bh'] = bh\n",
" else:\n",
" print(i,k,v['name'])\n",
" i+=1\n",
"filename = 'data/杨庙补充汇总信息.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(dict_base, fl, ensure_ascii=False,default=str)\n",
"print('ok')"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "d31fa9b7-26d8-4101-94d1-f41723428aa9", "id": "d31fa9b7-26d8-4101-94d1-f41723428aa9",
@@ -358,28 +500,9 @@
"execution_count": null, "execution_count": null,
"id": "dc20aabb-3942-49b9-8841-8e8a0823033a", "id": "dc20aabb-3942-49b9-8841-8e8a0823033a",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-03-24T14:39:51.668924Z",
"iopub.status.busy": "2023-03-24T14:39:51.668395Z",
"iopub.status.idle": "2023-03-24T14:39:51.935114Z",
"shell.execute_reply": "2023-03-24T14:39:51.933808Z",
"shell.execute_reply.started": "2023-03-24T14:39:51.668877Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"59\n",
"108\n",
"389\n",
"268\n",
"270\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import json\n", "import json\n",
@@ -420,23 +543,9 @@
"execution_count": null, "execution_count": null,
"id": "09a354e6-a07a-40b8-9b8c-3499fb0b7c28", "id": "09a354e6-a07a-40b8-9b8c-3499fb0b7c28",
"metadata": { "metadata": {
"execution": {
"iopub.execute_input": "2023-03-24T14:39:29.249485Z",
"iopub.status.busy": "2023-03-24T14:39:29.248954Z"
},
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"(192, 190, 194, 195, 196, 197, 198, 18, 17, 16, 15, 14, 13, 12, 11, 9, 8, 7, 6, 5, 4, 436, 120, 121, 122, 124, 123, 130, 126, 133, 136, 135, 137, 138, 139, 140, 141, 142, 143, 144, 151, 150, 157, 158, 159, 160, 166, 167, 118, 117, 116, 115, 114, 111, 110, 109, 106, 105, 103, 102, 101, 100, 98, 96, 95, 94, 93, 90, 89, 88, 87, 86, 85, 83, 82, 80, 79, 77, 76, 230, 231, 237, 235, 233, 234, 239, 236, 238, 241, 243, 244, 242, 249, 256, 257, 258, 164, 165, 168, 162, 163, 74, 75, 73, 67, 59, 57, 56, 55, 53, 52, 49, 48, 47, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 31, 30, 29, 26, 25, 24, 23, 170, 172, 169, 171, 175, 179, 183, 184, 186, 187, 188, 289, 290, 293, 294, 296, 305, 307, 308, 306, 310, 309, 311, 312, 316, 203, 199, 202, 207, 209, 210, 214, 212, 211, 216, 218, 219, 220, 221, 226, 227, 222, 223, 229, 232, 398, 401, 399, 403, 405, 406, 407, 415, 416, 6002, 424, 430, 346, 349, 348, 353, 357, 355, 351, 356, 362, 363, 364, 365, 369, 368, 371, 373, 377, 379, 376, 372, 378, 382, 386, 387, 393, 392, 396, 400, 314, 317, 318, 324, 323, 322, 326, 325, 328, 331, 329, 330, 332, 334, 335, 336, 337, 333, 338, 339, 340, 341, 297, 343, 344, 259, 262, 264, 260, 265, 267, 272, 271, 274, 2734, 275, 277, 276, 280, 281, 284, 283, 282, 286, 288, 228, 345)\n",
"264\n",
"264\n"
]
}
],
"source": [ "source": [
"import openpyxl\n", "import openpyxl\n",
"import json\n", "import json\n",
@@ -466,10 +575,64 @@
"print(dict1)" "print(dict1)"
] ]
}, },
{
"cell_type": "markdown",
"id": "3262d713-92a4-4790-81a3-976ff308ee3d",
"metadata": {},
"source": [
"## 统计网络问卷信息"
]
},
{
"cell_type": "code",
"execution_count": 119,
"id": "08980670-fda9-4660-a619-2f5f5ed8d334",
"metadata": {
"execution": {
"iopub.execute_input": "2023-03-25T13:14:20.914416Z",
"iopub.status.busy": "2023-03-25T13:14:20.913887Z",
"iopub.status.idle": "2023-03-25T13:14:20.939567Z",
"shell.execute_reply": "2023-03-25T13:14:20.938206Z",
"shell.execute_reply.started": "2023-03-25T13:14:20.914370Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"68\n",
"68\n"
]
}
],
"source": [
"filename = 'data/merge1.json'\n",
"\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"#print(dict1)\n",
"filename = 'data/杨庙补充汇总信息.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl)\n",
"dict3 = {}\n",
"for k, v in dict1.items():\n",
" print(len(v))\n",
" for item in v:\n",
" phone = item['phone']\n",
" dict3.setdefault(phone,{})\n",
" #dict3[phone]['data'] = v['data']\n",
" for k1,v1 in dict2.items():\n",
" if 'phone' in v1.keys() and phone == v1['phone']:\n",
" dict3[phone]['bh'] = k1\n",
"print(len(dict3)) "
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "10198e81-cea0-475a-bce7-4a4829320517", "id": "f69677a3-57bb-43b0-9d62-38330d86bddd",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []