This commit is contained in:
512song committed 2023-10-23 02:36:43 +00:00
1 parent 626973d224
commit fbfc27add3
2 files changed
+140 -93

No files matched your search

+99 -79
View File
@@ -10,27 +10,12 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-20T09:14:31.635091Z",
"iopub.status.busy": "2023-10-20T09:14:31.634228Z",
"iopub.status.idle": "2023-10-20T09:14:31.688961Z",
"shell.execute_reply": "2023-10-20T09:14:31.687120Z",
"shell.execute_reply.started": "2023-10-20T09:14:31.635013Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -50,7 +35,7 @@
" dict1['sex'] = sheet.cell(n, 3).value\n",
" dict1['birth'] = str(sheet.cell(n,4).value).split(' ')[0]\n",
" if sheet.cell(n,5).value is not None:\n",
" dict1['phone'] = sheet.cell(n,5).value\n",
" dict1['phone'] = str(sheet.cell(n,5).value)\n",
" \n",
" person[code] = dict1\n",
"filename = 'data/政法委.json'\n",
@@ -69,27 +54,12 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"id": "ce406710-6b7d-4c51-98ec-78883bd3ce5f",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-19T05:29:01.332376Z",
"iopub.status.busy": "2023-10-19T05:29:01.331567Z",
"iopub.status.idle": "2023-10-19T05:29:01.352888Z",
"shell.execute_reply": "2023-10-19T05:29:01.350586Z",
"shell.execute_reply.started": "2023-10-19T05:29:01.332301Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"\n",
@@ -122,28 +92,12 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-20T09:14:46.683022Z",
"iopub.status.busy": "2023-10-20T09:14:46.681792Z",
"iopub.status.idle": "2023-10-20T09:14:46.726814Z",
"shell.execute_reply": "2023-10-20T09:14:46.724006Z",
"shell.execute_reply.started": "2023-10-20T09:14:46.682951Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"25\n",
"25\n"
]
}
],
"outputs": [],
"source": [
"import json\n",
"import time\n",
@@ -201,16 +155,9 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"id": "867ad6b0-9e9d-48bc-a10a-3b9cb6125890",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-20T09:16:05.643852Z",
"iopub.status.busy": "2023-10-20T09:16:05.643571Z",
"iopub.status.idle": "2023-10-20T09:16:05.697130Z",
"shell.execute_reply": "2023-10-20T09:16:05.695645Z",
"shell.execute_reply.started": "2023-10-20T09:16:05.643830Z"
},
"tags": []
},
"outputs": [],
@@ -264,27 +211,12 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "def3f47a-24ef-4815-b63b-2a16b79b4c15",
"metadata": {
"execution": {
"iopub.execute_input": "2023-10-20T09:07:18.193797Z",
"iopub.status.busy": "2023-10-20T09:07:18.193078Z",
"iopub.status.idle": "2023-10-20T09:07:18.226391Z",
"shell.execute_reply": "2023-10-20T09:07:18.225076Z",
"shell.execute_reply.started": "2023-10-20T09:07:18.193731Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[(496535, 2, 5, 3, '2023-10-20', '2023-10-20 17:00:00'), (496535, 8, 5, 20, '2023-10-20', '2023-10-20 17:00:00'), (496535, 42, 5, 29, '2023-10-20', '2023-10-20 17:00:00'), (496535, 22, 5, 30, '2023-10-20', '2023-10-20 17:00:00'), (496535, 21, 5, 43, '2023-10-20', '2023-10-20 17:00:00'), (496535, 12, 5, 20, '2023-10-20', '2023-10-20 17:00:00'), (496535, 4, 5, 38, '2023-10-20', '2023-10-20 17:00:00'), (496535, 30, 5, 10, '2023-10-20', '2023-10-20 17:00:00'), (496535, 2, 3, -118, '2023-10-20', '2023-10-20 17:00:00')]\n"
]
}
],
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
@@ -307,10 +239,98 @@
"print(list1)"
]
},
{
"cell_type": "markdown",
"id": "5c72d14d-0f75-41d5-a334-fc16f4a2d275",
"metadata": {},
"source": [
"## 统计未参加问卷人员信息"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "67e63f07-3f20-4e0e-9c07-7bf6024eeb4b",
"id": "5b646b5d-c4f6-4d37-9510-30fcbef44855",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"\n",
"filename = 'data/政法委.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"phone = set()\n",
"phone1 = set()\n",
"for k,v in dict1.items():\n",
" if 'phone' in v.keys():\n",
" phone.add(v['phone'])\n",
"list1 = []\n",
"filename = 'data/Survey_20231023-1698026051370.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",
" phone1.add(result[2])\n",
"\n",
"for k, v in dict1.items():\n",
" if 'phone' in v.keys():\n",
" item = str(v['phone'])\n",
" if item not in phone1:\n",
" print(k,v['name'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0bc15d3a-e0a4-4089-9891-be3da20660cc",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import json\n",
"import csv\n",
"import openpyxl\n",
"\n",
"filename = 'data/政法委.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"phone = set()\n",
"phone1 = set()\n",
"for k,v in dict1.items():\n",
" if 'phone' in v.keys():\n",
" phone.add(v['phone'])\n",
"list1 = []\n",
"filename = 'data/Survey_20231023-1698026051370.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",
" phone1.add(result[2])\n",
"\n",
"for item in phone1:\n",
" if item in phone:\n",
" print(item)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6a81d762-86d8-4adf-a0cb-3506a32aef3f",
"metadata": {},
"outputs": [],
"source": []