This commit is contained in:
512song committed 2024-05-20 23:07:26 +08:00
1 parent f69c4ca26c
commit e517be289b
2 files changed
+983 -20

No files matched your search

+32 -18
View File
@@ -580,19 +580,30 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 8,
"id": "67e63f07-3f20-4e0e-9c07-7bf6024eeb4b",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-15T13:07:51.870000Z",
"iopub.status.busy": "2024-05-15T13:07:51.869517Z",
"iopub.status.idle": "2024-05-15T13:07:51.955483Z",
"shell.execute_reply": "2024-05-15T13:07:51.954880Z",
"shell.execute_reply.started": "2024-05-15T13:07:51.869961Z"
"iopub.execute_input": "2024-05-20T06:58:40.070876Z",
"iopub.status.busy": "2024-05-20T06:58:40.070141Z",
"iopub.status.idle": "2024-05-20T06:58:40.090900Z",
"shell.execute_reply": "2024-05-20T06:58:40.090430Z",
"shell.execute_reply.started": "2024-05-20T06:58:40.070810Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"18993710898\n",
"18894239366\n",
"13801023617\n",
"18093715391\n"
]
}
],
"source": [
"import json\n",
"import csv\n",
@@ -613,7 +624,7 @@
" if 'phone' in v.keys():\n",
" phone[v['phone']] = k\n",
"list1 = []\n",
"filename = 'data/Survey_20240515.csv'\n",
"filename = 'data/Survey_20240520.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -648,7 +659,8 @@
" content = json.loads(item[5])\n",
" if phone[item[2]] not in dict1.keys():\n",
" dict1[phone[item[2]]] = dict3[phone[item[2]]]\n",
" rq = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n",
" #print(item[2])\n",
" rq = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n",
" #dict1[phone[item[2]]]['rq'] = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n",
" for k, v in content.items():\n",
" if 'psy' in k:\n",
@@ -678,7 +690,9 @@
" days = (rq-birth).days \n",
" dict1[phone[item[2]]]['age'] = int(days/365)\n",
" dict1[phone[item[2]]]['month'] = int(days/365*12)\n",
"filename = 'data/result_青海all_1.json'\n",
" else:\n",
" print(item[2])\n",
"filename = 'data/result_青海all_2.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1, fl, ensure_ascii=False) "
@@ -787,15 +801,15 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 6,
"id": "11727a08-9da8-4eb2-aadf-69dc72031bdc",
"metadata": {
"execution": {
"iopub.execute_input": "2024-05-15T13:22:19.142337Z",
"iopub.status.busy": "2024-05-15T13:22:19.141830Z",
"iopub.status.idle": "2024-05-15T13:22:19.154540Z",
"shell.execute_reply": "2024-05-15T13:22:19.153585Z",
"shell.execute_reply.started": "2024-05-15T13:22:19.142284Z"
"iopub.execute_input": "2024-05-20T06:45:31.065931Z",
"iopub.status.busy": "2024-05-20T06:45:31.065241Z",
"iopub.status.idle": "2024-05-20T06:45:31.078036Z",
"shell.execute_reply": "2024-05-20T06:45:31.077063Z",
"shell.execute_reply.started": "2024-05-20T06:45:31.065872Z"
},
"tags": []
},
@@ -827,7 +841,7 @@
" tc.append(k)\n",
"print(len(tc))\n",
" \n",
"filename = 'data/result_青海all_1.json'\n",
"filename = 'data/result_青海all_2.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"for k, v in dict1.items():\n",
@@ -865,7 +879,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.3"
}
},
"nbformat": 4,