This commit is contained in:
512song committed 2023-12-12 04:43:05 +00:00
1 parent 54a610a08f
commit f47c1db021
2 files changed
+103 -66

No files matched your search

+68 -25
View File
@@ -1177,35 +1177,47 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 30,
"id": "714d4a20-9ca0-4439-880b-f68de8c0e2fb",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-12T04:23:01.972390Z",
"iopub.status.busy": "2023-12-12T04:23:01.971582Z",
"iopub.status.idle": "2023-12-12T04:23:02.066623Z",
"shell.execute_reply": "2023-12-12T04:23:02.064926Z",
"shell.execute_reply.started": "2023-12-12T04:23:01.972317Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('data/职工健康提升项目志愿者报名表(汇总).xlsx')\n",
"wb = openpyxl.load_workbook('data/副本2023年安庆石化职工健康提升项目志愿者花名册.xlsx')\n",
"sheet = wb.active\n",
"# sheets = wb.sheetnames\n",
"person = {}\n",
"\n",
"for n in range(3, sheet.max_row+1):\n",
"for n in range(2, sheet.max_row+1):\n",
" code = int(sheet.cell(n, 1).value)\n",
" person.setdefault(code, {})\n",
" dict1 = {}\n",
" dict1['name'] = sheet.cell(n, 4).value\n",
" dict1['sex'] = sheet.cell(n, 5).value\n",
" dict1['name'] = sheet.cell(n, 3).value\n",
" dict1['sex'] = sheet.cell(n, 4).value\n",
" dict1['unit'] = sheet.cell(n, 2).value\n",
" dict1['job'] = sheet.cell(n, 3).value\n",
" dict1['age'] = int(sheet.cell(n, 6).value)\n",
" dict1['phone'] = str(sheet.cell(n,7).value)\n",
" dict1['note'] = sheet.cell(n,8).value\n",
" dict1['phone'] = str(sheet.cell(n,5).value)\n",
" person[code] = dict1\n",
"filename = 'data/安庆职工健康提升志愿者.json'\n",
"filename = 'data/安庆职工健康提升志愿者1.json'\n",
"with open(filename, 'w') as fl:\n",
" json.dump(person, fl, ensure_ascii=False)\n",
"print('ok')"
@@ -1221,15 +1233,15 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 31,
"id": "dcdd18b3-d7b7-49b1-b148-c2ea9a7799ff",
"metadata": {
"execution": {
"iopub.execute_input": "2023-11-21T03:09:53.451357Z",
"iopub.status.busy": "2023-11-21T03:09:53.450510Z",
"iopub.status.idle": "2023-11-21T03:09:53.535389Z",
"shell.execute_reply": "2023-11-21T03:09:53.534089Z",
"shell.execute_reply.started": "2023-11-21T03:09:53.451280Z"
"iopub.execute_input": "2023-12-12T04:23:54.507193Z",
"iopub.status.busy": "2023-12-12T04:23:54.506388Z",
"iopub.status.idle": "2023-12-12T04:23:54.583968Z",
"shell.execute_reply": "2023-12-12T04:23:54.582552Z",
"shell.execute_reply.started": "2023-12-12T04:23:54.507133Z"
},
"tags": []
},
@@ -1247,7 +1259,7 @@
"import csv\n",
"import openpyxl\n",
"\n",
"filename = 'data/安庆职工健康提升志愿者.json'\n",
"filename = 'data/安庆职工健康提升志愿者1.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
@@ -1255,7 +1267,7 @@
"wj_dm = {'psy_0556_sh':0,'tcm_0556_sh':1,'spine_0556_sh':2}\n",
"list1 = []\n",
"re_ta = {}\n",
"filename = 'data/Survey_20231121.csv'\n",
"filename = 'data/Survey_20231211-1702260996888.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -1286,15 +1298,13 @@
" list2.append(item)\n",
" list1.append(list2)\n",
" \n",
"filename = 'data/安庆职工健康提升问卷情况表.xlsx'\n",
"filename = 'data/安庆职工健康提升问卷情况表20231212.xlsx'\n",
"wb = openpyxl.Workbook()\n",
"sheet = wb.active\n",
"title = ['编号','员工姓名','手机号码','心理','中医','脊柱']\n",
"sheet.append(title)\n",
"for row in list1:\n",
" sheet.append(row)\n",
"\n",
"\n",
"wb.save(filename) \n",
" "
]
@@ -1309,12 +1319,45 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 29,
"id": "ea4fffc4-3c6e-4f85-819f-52f969e04dd7",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-12T04:06:50.977355Z",
"iopub.status.busy": "2023-12-12T04:06:50.976552Z",
"iopub.status.idle": "2023-12-12T04:06:51.007761Z",
"shell.execute_reply": "2023-12-12T04:06:51.005174Z",
"shell.execute_reply.started": "2023-12-12T04:06:50.977281Z"
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"18055696268\n",
"13865166211\n",
"13966607917\n",
"13855640093\n",
"18155688687\n",
"15156230686\n",
"13074076020\n",
"18655663060\n",
"15905566828\n",
"13905562130\n",
"13855602427\n",
"13966613066\n",
"15856585658\n",
"13909669602\n",
"18055691637\n",
"18755696791\n",
"19955611658\n",
"13966637322\n",
"13955603120\n"
]
}
],
"source": [
"import json\n",
"import csv\n",
@@ -1329,7 +1372,7 @@
"for k,v in dict1.items():\n",
" phone.add(v['phone'])\n",
"\n",
"filename = 'data/Survey_20231018.csv'\n",
"filename = 'data/Survey_20231211-1702260996888.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",