20230905
This commit is contained in:
1 parent
24a9839483
commit
23ce121293
11 files changed
+1506
-561
No files matched your search
+192
-275
@@ -10,27 +10,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 94,
|
||||
"execution_count": null,
|
||||
"id": "07f7e97e-670e-4301-b83d-1304514f15d5",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:45:10.229928Z",
|
||||
"iopub.status.busy": "2023-07-05T02:45:10.229085Z",
|
||||
"iopub.status.idle": "2023-07-05T02:45:10.320665Z",
|
||||
"shell.execute_reply": "2023-07-05T02:45:10.319936Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:45:10.229888Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
@@ -65,6 +50,56 @@
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "be805082-d5d7-405b-975c-fb902085a041",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 文件更名"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "b51cf562-c708-4164-8431-5093247880c4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os,sys,shutil\n",
|
||||
"import json\n",
|
||||
"import math\n",
|
||||
"import glob\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"fi_path = 'file/2023-06-07'\n",
|
||||
"old = []\n",
|
||||
"dict2 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/西藏人员.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" m_name = v['name']\n",
|
||||
" dict2[int(k)] = [m_name]\n",
|
||||
"\n",
|
||||
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
|
||||
"\n",
|
||||
"for fn in fls:\n",
|
||||
" old.append(os.path.basename(fn).split('.')[0])\n",
|
||||
"\n",
|
||||
"for n in old: \n",
|
||||
" o_name = f'{fi_path}/{n}.pdf'\n",
|
||||
" new_path = Path(fi_path,'new')\n",
|
||||
" new_path.mkdir(parents = True, exist_ok = True)\n",
|
||||
" n_name = Path(new_path,f'{str(n).rjust(5,\"0\")}-{dict2[int(n)][0]}.pdf')\n",
|
||||
" if not os.path.exists(n_name):\n",
|
||||
" shutil.copyfile(o_name,n_name)\n",
|
||||
" print(n_name)\n",
|
||||
" \n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "962f6edd-c8d1-42a2-aaff-58f92ccf8d56",
|
||||
@@ -309,28 +344,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 66,
|
||||
"execution_count": null,
|
||||
"id": "e19a4c58-df1e-4136-bf10-33e9ed885e50",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-04T13:02:15.967924Z",
|
||||
"iopub.status.busy": "2023-07-04T13:02:15.967138Z",
|
||||
"iopub.status.idle": "2023-07-04T13:02:16.005279Z",
|
||||
"shell.execute_reply": "2023-07-04T13:02:16.004236Z",
|
||||
"shell.execute_reply.started": "2023-07-04T13:02:15.967883Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"165\n",
|
||||
"165\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
@@ -447,31 +466,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 95,
|
||||
"execution_count": null,
|
||||
"id": "3696d7e1-afb8-4f9d-ba29-9aaa977b52de",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:45:28.348666Z",
|
||||
"iopub.status.busy": "2023-07-05T02:45:28.348242Z",
|
||||
"iopub.status.idle": "2023-07-05T02:45:28.389486Z",
|
||||
"shell.execute_reply": "2023-07-05T02:45:28.388452Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:45:28.348638Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"165\n",
|
||||
"[]\n",
|
||||
"165\n",
|
||||
"ok\n",
|
||||
"165\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import time\n",
|
||||
@@ -491,7 +491,7 @@
|
||||
"re_ta = {}\n",
|
||||
"list1 = []\n",
|
||||
"#print(\"\\n运动项目信息:\")\n",
|
||||
"filename = 'data/places_result_20230704.csv'\n",
|
||||
"filename = 'data/places_result_20230714.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -540,27 +540,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 96,
|
||||
"execution_count": null,
|
||||
"id": "b71c8bf6-2530-425f-9516-8757b40e3dc5",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:45:31.683237Z",
|
||||
"iopub.status.busy": "2023-07-05T02:45:31.682418Z",
|
||||
"iopub.status.idle": "2023-07-05T02:45:31.710877Z",
|
||||
"shell.execute_reply": "2023-07-05T02:45:31.709811Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:45:31.683198Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
@@ -592,27 +577,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 97,
|
||||
"execution_count": null,
|
||||
"id": "0e75cfbb-2b63-4163-831c-933fff1481c2",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:45:50.311946Z",
|
||||
"iopub.status.busy": "2023-07-05T02:45:50.311092Z",
|
||||
"iopub.status.idle": "2023-07-05T02:45:50.340231Z",
|
||||
"shell.execute_reply": "2023-07-05T02:45:50.339150Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:45:50.311906Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -646,31 +616,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 98,
|
||||
"execution_count": null,
|
||||
"id": "99f02e37-3a03-4d7d-a2b9-7bf5563c253c",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:45:52.771879Z",
|
||||
"iopub.status.busy": "2023-07-05T02:45:52.771043Z",
|
||||
"iopub.status.idle": "2023-07-05T02:45:52.802079Z",
|
||||
"shell.execute_reply": "2023-07-05T02:45:52.801054Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:45:52.771839Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"0~255分人数:115人,男性:67人,女性:48人\n",
|
||||
"256~332分人数:42人,男性:27人,女性:15人\n",
|
||||
"333~367分人数:8人,男性:4人,女性:4人\n",
|
||||
"368~500分人数:0人,男性:0人,女性:0人\n",
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -714,34 +665,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 99,
|
||||
"execution_count": null,
|
||||
"id": "1435c8af-094d-44b3-a024-af3615c07c21",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:45:57.071802Z",
|
||||
"iopub.status.busy": "2023-07-05T02:45:57.070977Z",
|
||||
"iopub.status.idle": "2023-07-05T02:45:57.086551Z",
|
||||
"shell.execute_reply": "2023-07-05T02:45:57.085522Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:45:57.071762Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"20~24岁平均成绩:2.43分,人数:9人,男性:7人\n",
|
||||
"25~29岁平均成绩:2.14分,人数:49人,男性:27人\n",
|
||||
"30~34岁平均成绩:2.26分,人数:38人,男性:22人\n",
|
||||
"35~39岁平均成绩:2.39分,人数:27人,男性:12人\n",
|
||||
"40~44岁平均成绩:2.37分,人数:26人,男性:15人\n",
|
||||
"45~49岁平均成绩:2.52分,人数:10人,男性:9人\n",
|
||||
"50~54岁平均成绩:2.48分,人数:5人,男性:5人\n",
|
||||
"55~69岁平均成绩:2.67分,人数:1人,男性:1人\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -776,34 +705,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 100,
|
||||
"execution_count": null,
|
||||
"id": "650cf1eb-8681-4911-9b04-80468fe6bf64",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:47:11.272824Z",
|
||||
"iopub.status.busy": "2023-07-05T02:47:11.271965Z",
|
||||
"iopub.status.idle": "2023-07-05T02:47:11.287782Z",
|
||||
"shell.execute_reply": "2023-07-05T02:47:11.286539Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:47:11.272783Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"20~24岁平均成绩:2.45分,人数:7人\n",
|
||||
"25~29岁平均成绩:2.0分,人数:27人\n",
|
||||
"30~34岁平均成绩:2.39分,人数:22人\n",
|
||||
"35~39岁平均成绩:2.36分,人数:12人\n",
|
||||
"40~44岁平均成绩:2.53分,人数:15人\n",
|
||||
"45~49岁平均成绩:2.54分,人数:9人\n",
|
||||
"50~54岁平均成绩:2.48分,人数:5人\n",
|
||||
"55~80岁平均成绩:2.67分,人数:1人\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -838,34 +745,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 74,
|
||||
"execution_count": null,
|
||||
"id": "9ccb9b3c-de57-49f4-a4c6-10a24737e857",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-04T13:08:22.477549Z",
|
||||
"iopub.status.busy": "2023-07-04T13:08:22.476783Z",
|
||||
"iopub.status.idle": "2023-07-04T13:08:22.492628Z",
|
||||
"shell.execute_reply": "2023-07-04T13:08:22.491401Z",
|
||||
"shell.execute_reply.started": "2023-07-04T13:08:22.477510Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"20~24岁平均成绩:2.33分,人数:2人\n",
|
||||
"25~29岁平均成绩:2.32分,人数:22人\n",
|
||||
"30~34岁平均成绩:2.07分,人数:16人\n",
|
||||
"35~39岁平均成绩:2.41分,人数:15人\n",
|
||||
"40~44岁平均成绩:2.15分,人数:11人\n",
|
||||
"45~49岁平均成绩:2.33分,人数:1人\n",
|
||||
"50~54岁平均成绩:0分,人数:0人\n",
|
||||
"55~80岁平均成绩:0分,人数:0人\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -899,29 +784,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 104,
|
||||
"execution_count": null,
|
||||
"id": "c8cd897e-0d41-4faa-860f-395d42208674",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T03:18:05.849161Z",
|
||||
"iopub.status.busy": "2023-07-05T03:18:05.848313Z",
|
||||
"iopub.status.idle": "2023-07-05T03:18:05.864430Z",
|
||||
"shell.execute_reply": "2023-07-05T03:18:05.863382Z",
|
||||
"shell.execute_reply.started": "2023-07-05T03:18:05.849120Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"平均成绩:2.3266分,男性:98人\n",
|
||||
"平均成绩:2.2533分,女性:67人\n",
|
||||
"平均成绩:2.2968分,总体:165人\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"\n",
|
||||
@@ -960,34 +828,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 91,
|
||||
"execution_count": null,
|
||||
"id": "28b418f2-2324-450f-9684-4df15e012694",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:43:38.489757Z",
|
||||
"iopub.status.busy": "2023-07-05T02:43:38.488929Z",
|
||||
"iopub.status.idle": "2023-07-05T02:43:38.506679Z",
|
||||
"shell.execute_reply": "2023-07-05T02:43:38.505448Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:43:38.489716Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"20-24 {'合格': 1, '不合格': 1}\n",
|
||||
"25-29 {'良好': 2, '不合格': 15, '合格': 5}\n",
|
||||
"30-34 {'合格': 3, '不合格': 12, '良好': 1}\n",
|
||||
"35-39 {'合格': 4, '良好': 1, '不合格': 10}\n",
|
||||
"40-44 {'不合格': 9, '良好': 0, '合格': 2}\n",
|
||||
"45-49 {'不合格': 1, '合格': 0, '良好': 0}\n",
|
||||
"50-54 {'合格': 0, '良好': 0, '不合格': 0}\n",
|
||||
"55-80 {'合格': 0}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
|
||||
"\n",
|
||||
@@ -1027,34 +873,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 102,
|
||||
"execution_count": null,
|
||||
"id": "a80224fb-1726-4370-9d3d-6e0a27afa8b2",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:47:19.469192Z",
|
||||
"iopub.status.busy": "2023-07-05T02:47:19.468357Z",
|
||||
"iopub.status.idle": "2023-07-05T02:47:19.486494Z",
|
||||
"shell.execute_reply": "2023-07-05T02:47:19.485227Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:47:19.469153Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"20-24 {'合格': 3, '不合格': 4}\n",
|
||||
"25-29 {'良好': 0, '不合格': 24, '合格': 3}\n",
|
||||
"30-34 {'合格': 7, '不合格': 15, '良好': 0}\n",
|
||||
"35-39 {'合格': 5, '良好': 0, '不合格': 7}\n",
|
||||
"40-44 {'不合格': 9, '良好': 1, '合格': 5}\n",
|
||||
"45-49 {'不合格': 5, '合格': 2, '良好': 2}\n",
|
||||
"50-54 {'合格': 1, '良好': 1, '不合格': 3}\n",
|
||||
"55-80 {'合格': 1}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"nld = [[20,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,80]]\n",
|
||||
"\n",
|
||||
@@ -1094,32 +918,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 103,
|
||||
"execution_count": null,
|
||||
"id": "945b9bec-247b-498b-96f6-a52fabbf6c89",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-05T02:47:22.379999Z",
|
||||
"iopub.status.busy": "2023-07-05T02:47:22.379167Z",
|
||||
"iopub.status.idle": "2023-07-05T02:47:22.392962Z",
|
||||
"shell.execute_reply": "2023-07-05T02:47:22.391756Z",
|
||||
"shell.execute_reply.started": "2023-07-05T02:47:22.379959Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"体重 3.46 164\n",
|
||||
"肺活量 2.22 164\n",
|
||||
"握力 1.19 164\n",
|
||||
"坐位体前屈 1.9 163\n",
|
||||
"单脚站立 2.19 165\n",
|
||||
"选择反应时 2.8 165\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
@@ -1134,10 +938,123 @@
|
||||
" print(item,round(score/n,2),n)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "abba5b74-bfcd-4ec0-b682-10170138ff36",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 生成脊椎情况明细"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "c840e9b2-ce95-40c5-9f67-438a88ae0736",
|
||||
"id": "da4ba403-92a8-4fd8-8dfc-49802b941fca",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"id": "aebb4eb4-2bcd-411c-8868-292fae38d8b5",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-19T05:21:21.489267Z",
|
||||
"iopub.status.busy": "2023-07-19T05:21:21.488401Z",
|
||||
"iopub.status.idle": "2023-07-19T05:21:21.503231Z",
|
||||
"shell.execute_reply": "2023-07-19T05:21:21.502005Z",
|
||||
"shell.execute_reply.started": "2023-07-19T05:21:21.489227Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"{'q1': 34, 'q2': 37, 'q3': 32, 'q4': 86, 'q5': 55, 'q6': 33, 'q7': 63, 'q8': 29, 'q9': 59, 'q10': 14, 'q11': 47, 'q12': 58, 'q13': 14, 'q14': 8, 'q15': 54, 'q16': 52, 'q17': 20, 'q18': 54, 'q19': 43, 'q20': 1, 'q21': 31, 'q22': 22, 'q23': 50, 'q24': 10, 'q25': 2}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"dict2 = {}\n",
|
||||
"for i in range(1,26):\n",
|
||||
" dict1[f'q{str(i)}'] = 0\n",
|
||||
" \n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/Survey_20230719.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",
|
||||
"list2 = []\n",
|
||||
"for result in list1:\n",
|
||||
" data = json.loads(result[5].strip())\n",
|
||||
" for k, v in data.items():\n",
|
||||
" if v:\n",
|
||||
" dict1[k] += 1\n",
|
||||
"print(dict1) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"id": "ad102064-de18-41aa-9829-b9b398df53d6",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-07-19T05:18:48.000423Z",
|
||||
"iopub.status.busy": "2023-07-19T05:18:47.999556Z",
|
||||
"iopub.status.idle": "2023-07-19T05:18:48.014467Z",
|
||||
"shell.execute_reply": "2023-07-19T05:18:48.013436Z",
|
||||
"shell.execute_reply.started": "2023-07-19T05:18:48.000379Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"['10422', 'zsyxz1', '', '张斌', '35', '{\"q25\":true,\"q1\":false,\"q2\":false,\"q3\":false,\"q4\":true,\"q5\":true,\"q6\":true,\"q7\":true,\"q8\":false,\"q9\":true,\"q10\":false,\"q11\":false,\"q12\":false,\"q13\":false,\"q14\":false,\"q15\":true,\"q16\":false,\"q17\":false,\"q18\":false,\"q19\":true,\"q20\":false,\"q21\":true,\"q22\":false,\"q23\":false,\"q24\":true}', '2023-06-01 20:00:00']\n",
|
||||
"['10424', 'zsyxz1', '', '余兴见', '85', '{\"q25\":true,\"q1\":false,\"q2\":true,\"q3\":false,\"q4\":true,\"q5\":true,\"q6\":false,\"q7\":true,\"q8\":true,\"q9\":true,\"q10\":false,\"q11\":true,\"q12\":true,\"q13\":false,\"q14\":false,\"q15\":true,\"q16\":true,\"q17\":true,\"q18\":false,\"q19\":false,\"q20\":false,\"q21\":true,\"q22\":true,\"q23\":false,\"q24\":true}', '2023-06-01 20:00:00']\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import csv\n",
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"dict2 = {}\n",
|
||||
"for i in range(1,26):\n",
|
||||
" dict1[f'q{str(i)}'] = 0\n",
|
||||
" \n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/Survey_20230719.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",
|
||||
"list2 = []\n",
|
||||
"for result in list1:\n",
|
||||
" data = json.loads(result[5].strip())\n",
|
||||
" for k, v in data.items():\n",
|
||||
" if k == 'q25'and v:\n",
|
||||
" print(result)\n",
|
||||
"#print(dict1) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2787bc9f-6492-4b51-9b37-87ac098d93b9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
@@ -1159,7 +1076,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.6"
|
||||
"version": "3.10.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in new issue
Block a user