diff --git a/数据处理.ipynb b/数据处理.ipynb index 0808c1f..2e6ec02 100644 --- a/数据处理.ipynb +++ b/数据处理.ipynb @@ -786,7 +786,6 @@ { "cell_type": "markdown", "metadata": { - "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source": [ @@ -845,15 +844,8 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "metadata": { - "execution": { - "iopub.execute_input": "2021-12-17T01:17:00.335807Z", - "iopub.status.busy": "2021-12-17T01:17:00.334807Z", - "iopub.status.idle": "2021-12-17T01:17:00.469071Z", - "shell.execute_reply": "2021-12-17T01:17:00.469071Z", - "shell.execute_reply.started": "2021-12-17T01:17:00.335807Z" - }, "tags": [] }, "outputs": [], @@ -891,15 +883,8 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "metadata": { - "execution": { - "iopub.execute_input": "2021-12-17T01:40:10.503538Z", - "iopub.status.busy": "2021-12-17T01:40:10.503538Z", - "iopub.status.idle": "2021-12-17T01:40:10.673044Z", - "shell.execute_reply": "2021-12-17T01:40:10.672043Z", - "shell.execute_reply.started": "2021-12-17T01:40:10.503538Z" - }, "tags": [] }, "outputs": [], @@ -934,15 +919,8 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "metadata": { - "execution": { - "iopub.execute_input": "2021-12-17T02:50:20.560344Z", - "iopub.status.busy": "2021-12-17T02:50:20.560344Z", - "iopub.status.idle": "2021-12-17T02:50:21.226478Z", - "shell.execute_reply": "2021-12-17T02:50:21.226478Z", - "shell.execute_reply.started": "2021-12-17T02:50:20.560344Z" - }, "tags": [] }, "outputs": [], @@ -996,15 +974,8 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "metadata": { - "execution": { - "iopub.execute_input": "2021-12-17T03:08:55.050632Z", - "iopub.status.busy": "2021-12-17T03:08:55.050632Z", - "iopub.status.idle": "2021-12-17T03:08:55.843287Z", - "shell.execute_reply": "2021-12-17T03:08:55.843287Z", - "shell.execute_reply.started": "2021-12-17T03:08:55.050632Z" - }, "tags": [] }, "outputs": [], @@ -1050,15 +1021,8 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": { - "execution": { - "iopub.execute_input": "2021-12-17T03:18:41.399609Z", - "iopub.status.busy": "2021-12-17T03:18:41.398609Z", - "iopub.status.idle": "2021-12-17T03:18:41.467625Z", - "shell.execute_reply": "2021-12-17T03:18:41.466624Z", - "shell.execute_reply.started": "2021-12-17T03:18:41.399609Z" - }, "tags": [] }, "outputs": [], @@ -1166,6 +1130,35 @@ "\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## excel数据读取" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "filename = 'data/长岭全成绩.xlsx'\n", + "wb = openpyxl.load_workbook(filename)\n", + "sheet = wb.active\n", + "data1 =list(sheet.values)\n", + "del data1[0]\n", + "print(data1)\n", + "#for data in data1:\n", + "# print(data)\n", + "\n" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1186,6 +1179,13 @@ "print(collist)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": null, diff --git a/文件管理1.ipynb b/文件管理1.ipynb index 052b134..fd3d8dc 100755 --- a/文件管理1.ipynb +++ b/文件管理1.ipynb @@ -64,6 +64,42 @@ "#print(dict1)" ] }, + { + "cell_type": "markdown", + "id": "bbf0b425-c0ce-4608-ae52-85a78ddcd6c0", + "metadata": {}, + "source": [ + "## 批量更换扩展名" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "2c2bd1d1-4d84-4639-ba20-c97c218ae275", + "metadata": { + "execution": { + "iopub.execute_input": "2022-05-06T14:01:25.901198Z", + "iopub.status.busy": "2022-05-06T14:01:25.900687Z", + "iopub.status.idle": "2022-05-06T14:01:25.911729Z", + "shell.execute_reply": "2022-05-06T14:01:25.910606Z", + "shell.execute_reply.started": "2022-05-06T14:01:25.901153Z" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import glob\n", + "import os,shutil\n", + "\n", + "filepath = 'file/yimo/'\n", + "old = 'SGF'\n", + "new = 'sgf'\n", + "files = glob.glob(f'{filepath}*.{old}')\n", + "for f in files:\n", + " new_file =os.path.splitext(f)[0]+'.'+new\n", + " os.rename(f,new_file)" + ] + }, { "cell_type": "markdown", "id": "69712868-6786-430b-8591-f6828d781588", diff --git a/高考志愿查询.ipynb b/高考志愿查询.ipynb index ca63156..e45ca5a 100644 --- a/高考志愿查询.ipynb +++ b/高考志愿查询.ipynb @@ -18,59 +18,10 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": null, "id": "be2371be-89f5-4879-82a9-4a1d9e6376d3", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1 南京中医药大学 中医学(本硕连读5+3一体化) 11019\n", - "2 天津医科大学 预防医学 11108\n", - "3 哈尔滨医科大学 临床医学 11227\n", - "4 空军军医大学 基础医学 11232\n", - "5 南京医科大学 预防医学 11275\n", - "6 温州医科大学 眼视光医学(5+3一体化) 11564\n", - "7 上海中医药大学 中医学(5+3一体化针灸推拿英语方向) 11620\n", - "8 兰州大学 临床医学类 11662\n", - "9 天津中医药大学 中医学(5+3一体化) 11825\n", - "10 哈尔滨医科大学 临床医学(5+3一体化,儿科学硕士) 11837\n", - "11 温州医科大学 临床医学(5+3一体化) 11869\n", - "12 东北大学 智能医学工程 11916\n", - "13 海军军医大学 中医学(中医临床医师) 11955\n", - "14 苏州大学 预防医学 11991\n", - "15 暨南大学 临床医学 12045\n", - "16 中国医科大学 医学影像学 12059\n", - "17 南昌大学 临床医学 12252\n", - "18 天津医科大学 医学影像技术 12272\n", - "19 吉林大学 预防医学 12320\n", - "20 南京航空航天大学 生物医学工程 12504\n", - "21 江南大学 临床医学 12526\n", - "22 广州中医药大学 中医学(5+3一体化) 12715\n", - "23 中国医科大学 基础医学 12755\n", - "24 重庆医科大学 医学影像学 12784\n", - "25 大连医科大学 临床医学(5+3一体化) 13012\n", - "26 天津医科大学 智能医学工程 13103\n", - "27 南京中医药大学 中医学 13301\n", - "28 温州医科大学 眼视光医学 13370\n", - "29 天津医科大学 医学检验技术 13371\n", - "30 天津医科大学 生物医学工程 13396\n", - "31 温州医科大学 临床医学 13421\n", - "32 中国医科大学 预防医学 13769\n", - "33 汕头大学 临床医学(5+3一体化) 13808\n", - "34 郑州大学 临床医学类 13981\n", - "35 郑州大学 口腔医学 14147\n", - "36 南方医科大学 基础医学 14160\n", - "37 哈尔滨医科大学 基础医学 14331\n", - "38 南方医科大学 预防医学 14366\n", - "39 大连医科大学 临床医学 14423\n", - "40 西北大学 临床医学 14492\n", - "41 天津中医药大学 中医学(5+3一体化中医儿科学) 14708\n", - "42 南京医科大学 智能医学工程 14721\n" - ] - } - ], + "outputs": [], "source": [ "import pymongo\n", "import re\n", diff --git a/高考志愿管理.ipynb b/高考志愿管理.ipynb index da018b3..e1c5622 100644 --- a/高考志愿管理.ipynb +++ b/高考志愿管理.ipynb @@ -3,8 +3,7 @@ { "cell_type": "markdown", "metadata": { - "tags": [], - "toc-hr-collapsed": true + "tags": [] }, "source": [ "# 高考志愿管理" @@ -80,6 +79,161 @@ "\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 2021年全国高等学校信息更新" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 2021年全国高等学校信息导出至json文件" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "execution": { + "iopub.execute_input": "2022-06-15T07:00:27.890983Z", + "iopub.status.busy": "2022-06-15T07:00:27.890444Z", + "iopub.status.idle": "2022-06-15T07:00:28.430955Z", + "shell.execute_reply": "2022-06-15T07:00:28.429949Z", + "shell.execute_reply.started": "2022-06-15T07:00:27.890936Z" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "filename = 'data/2021年全国普通高等学校名单.xlsx'\n", + "wb = openpyxl.load_workbook(filename)\n", + "sheet = wb.active\n", + "data1 =list(sheet.values)\n", + "del data1[0:3]\n", + "i = 1\n", + "dict1 = {}\n", + "for items in data1:\n", + " list1 = (items[1],str(items[2]),items[3],items[4],items[5],items[6])\n", + " dict1[i] = list1\n", + " i += 1 \n", + "with open('data/2021年全国普通高等学校名单.json','w') as fl2:\n", + " json.dump(dict1,fl2) \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 整理2021年全国高等学校信息" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "execution": { + "iopub.execute_input": "2022-06-15T08:26:50.903511Z", + "iopub.status.busy": "2022-06-15T08:26:50.902972Z", + "iopub.status.idle": "2022-06-15T08:26:50.972239Z", + "shell.execute_reply": "2022-06-15T08:26:50.971224Z", + "shell.execute_reply.started": "2022-06-15T08:26:50.903463Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "河北工业职业技术大学导入成功!\n", + "河北科技工程职业技术大学导入成功!\n", + "河北石油职业技术大学导入成功!\n", + "邢台应用技术职业学院导入成功!\n", + "山西工程科技职业大学导入成功!\n", + "吉林通用航空职业技术学院导入成功!\n", + "通化医药健康职业学院导入成功!\n", + "上海南湖职业技术学院导入成功!\n", + "浙江药科职业大学导入成功!\n", + "浙江金华科贸职业技术学院导入成功!\n", + "宿州航空职业学院导入成功!\n", + "和君职业学院导入成功!\n", + "滨州科技职业学院导入成功!\n", + "洛阳文化旅游职业学院导入成功!\n", + "周口文理职业学院导入成功!\n", + "信阳艺术职业学院导入成功!\n", + "郑州城建职业学院导入成功!\n", + "郑州医药健康职业学院导入成功!\n", + "湖北孝感美珈职业学院导入成功!\n", + "广州幼儿师范高等专科学校导入成功!\n", + "广东汕头幼儿师范高等专科学校导入成功!\n", + "广东梅州职业技术学院导入成功!\n", + "广东潮州卫生健康职业学院导入成功!\n", + "广东云浮中医药职业学院导入成功!\n", + "广东肇庆航空职业学院导入成功!\n", + "广西农业职业技术大学导入成功!\n", + "防城港职业技术学院导入成功!\n", + "广西信息职业技术学院导入成功!\n", + "广西农业工程职业技术学院导入成功!\n", + "北海康养职业学院导入成功!\n", + "重庆工信职业学院导入成功!\n", + "甘孜职业学院导入成功!\n", + "自贡职业技术学院导入成功!\n", + "贵阳康养职业大学导入成功!\n", + "贵州文化旅游职业学院导入成功!\n", + "宝鸡中北职业学院导入成功!\n", + "兰州石化职业技术大学导入成功!\n", + "兰州资源环境职业技术大学导入成功!\n", + "兰州航空职业技术学院导入成功!\n", + "白银希望职业技术学院导入成功!\n" + ] + } + ], + "source": [ + "import openpyxl\n", + "import json\n", + "import pymongo\n", + "\n", + "\n", + "filename = 'data/2021年全国普通高等学校名单.json'\n", + "with open(filename,'r') as fl:\n", + " m_xx = json.load(fl)\n", + "\n", + "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", + "mydb = myclient[\"gaokao\"]\n", + "mycol = mydb[\"college_2021\"]\n", + "\n", + "m_col = {}\n", + "\n", + "\n", + "for x in mycol.find({\"id_code\":{'$exists': 'true'}},{\"_id\": 0, \"id_code\": 1, \"name\": 1}):\n", + " m_col[x['id_code']] = x['name']\n", + "#print(m_col.keys())\n", + "for k, v in m_xx.items():\n", + " m_code = v[1]\n", + " #print(m_code)\n", + " if m_code not in m_col.keys():\n", + " dict1 = {}\n", + " dict1['id_code'] = v[1]\n", + " dict1['name'] = v[0]\n", + " dict1['charge'] = v[2]\n", + " dict1['city'] = v[3]\n", + " dict1['grade'] = v[4]\n", + " dict1['note'] = v[5]\n", + " mycol.insert_one(dict1) \n", + " print(dict1['name'] + '导入成功!')\n", + " #print(v[0],v[1])\n", + " \n", + "\n", + "\n", + " " + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -602,7 +756,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ diff --git a/高考数据导入.ipynb b/高考数据导入.ipynb index e17f00f..45aa074 100644 --- a/高考数据导入.ipynb +++ b/高考数据导入.ipynb @@ -166,6 +166,201 @@ "## 汇总学校录取分数及位次" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 汇总2021年学校录取情况" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import pymysql\n", + "import pymongo\n", + "\n", + "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", + "mydb = myclient[\"gaokao\"]\n", + "mycol = mydb[\"college_2021\"]\n", + "m_xx = {}\n", + "m_data = {}\n", + "m_mongo = {}\n", + "db = pymysql.connect(host = \"localhost\",user = \"root\",password = \"songyi\",database = \"gaokao\" )\n", + "cursor = db.cursor()\n", + "sql = 'SELECT college,SUM(plan),min(num_min),max(RANK_min) FROM admission_2021 GROUP BY college'\n", + "cursor.execute(sql)\n", + "results = cursor.fetchall()\n", + "i = 1\n", + "for result in results:\n", + " #m_xx.clear()\n", + " m_code = result[0]\n", + " m_nian ='2021'\n", + " m_lb = 'z'\n", + " m_xx.setdefault(m_code,{})\n", + " m_xx[m_code].setdefault(m_nian,{})\n", + " m_xx[m_code][m_nian].setdefault(m_lb,{})\n", + " m_xx[m_code][m_nian][m_lb] ['name']= '综合'\n", + " m_xx[m_code][m_nian][m_lb] ['dispense']= int(result[1])\n", + " m_xx[m_code][m_nian][m_lb] ['num_min']= result[2]\n", + " m_xx[m_code][m_nian][m_lb] ['rank_min']= result[3] \n", + " myquery = {'code':m_code}\n", + " colleges = mycol.find(myquery,{ \"_id\": 0, \"admission\": 1 })\n", + " for x in colleges:\n", + " for k, v in x.items():\n", + " for k1, v1 in v.items():\n", + " m_xx[m_code][k1] = v1\n", + "for k,v in m_xx.items():\n", + " #m_item ='admission.'+m_nian\n", + " m_mongo.clear() \n", + " myquery = {'code':k}\n", + " m_new = {\"$set\":{'admission':v}}\n", + " mycol.update_one(myquery,m_new)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 生成历年录取信息json文件" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import pymysql\n", + "import pymongo\n", + "\n", + "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", + "mydb = myclient[\"gaokao\"]\n", + "mycol = mydb[\"college_2021\"]\n", + "m_xx = {}\n", + "m_data = {}\n", + "m_mongo = {}\n", + "db = pymysql.connect(host = \"localhost\",user = \"root\",password = \"songyi\",database = \"gaokao\" )\n", + "cursor = db.cursor()\n", + "sql = 'SELECT college,SUM(plan),min(num_min),max(RANK_min) FROM admission_2021 GROUP BY college'\n", + "cursor.execute(sql)\n", + "results = cursor.fetchall()\n", + "i = 1\n", + "for result in results:\n", + " #m_xx.clear()\n", + " m_code = result[0]\n", + " m_nian ='2021'\n", + " m_lb = 'z'\n", + " m_xx.setdefault(m_code,{})\n", + " m_xx[m_code].setdefault(m_nian,{})\n", + " m_xx[m_code][m_nian].setdefault(m_lb,{})\n", + " m_xx[m_code][m_nian][m_lb] ['name']= '综合'\n", + " m_xx[m_code][m_nian][m_lb] ['dispense']= int(result[1])\n", + " m_xx[m_code][m_nian][m_lb] ['num_min']= result[2]\n", + " m_xx[m_code][m_nian][m_lb] ['rank_min']= result[3] \n", + " myquery = {'code':m_code}\n", + " colleges = mycol.find(myquery,{ \"_id\": 0, \"admission\": 1 })\n", + " for x in colleges:\n", + " for k, v in x.items():\n", + " for k1, v1 in v.items():\n", + " m_xx[m_code][k1] = v1\n", + "fl_name = 'data/admission17-21.json'\n", + "with open(fl_name,'w') as fl:\n", + " json.dump(m_xx,fl)\n", + "print('ok!')\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 2021年专业录取分数及位次" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "metadata": { + "execution": { + "iopub.execute_input": "2022-06-15T09:08:30.396155Z", + "iopub.status.busy": "2022-06-15T09:08:30.395636Z", + "iopub.status.idle": "2022-06-15T09:08:39.230104Z", + "shell.execute_reply": "2022-06-15T09:08:39.228838Z", + "shell.execute_reply.started": "2022-06-15T09:08:30.396108Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ok\n" + ] + } + ], + "source": [ + "import pymysql\n", + "import pymongo\n", + "import decimal\n", + "\n", + "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", + "mydb = myclient[\"gaokao\"]\n", + "mycol = mydb[\"college_2021\"]\n", + "mycol1 = mydb[\"admission_2021\"]\n", + "\n", + "m_col = {}\n", + "m_spe = {}\n", + "m_xx = {}\n", + "for x in mycol.find({\"code\":{'$exists': 'true'}},{\"_id\": 0, \"code\": 1, \"name\": 1}):\n", + " m_col[x['code']] = x['name']\n", + "\n", + "\n", + "db = pymysql.connect(host = \"localhost\",user = \"songyi\",password = \"yylzs\",database = \"gaokao\" )\n", + "cursor = db.cursor()\n", + "sql = 'SELECT a.code,a.college,a.name FROM speciality AS a WHERE a.nian=\"2021\"'\n", + "cursor.execute(sql)\n", + "results = cursor.fetchall()\n", + "for result in results:\n", + " m_spe.setdefault(result[1],{}) \n", + " m_spe[result[1]][result[0]] = result[2]\n", + "sql = 'SELECT * FROM admission_2021 AS a where college not in (\"D628\",\"D440\",\"Y010\",\"D245\") ORDER BY a.rank_min'\n", + "cursor.execute(sql)\n", + "results = cursor.fetchall()\n", + "i = 0\n", + "m_min = 0\n", + "ii = 0\n", + "for result in results:\n", + " m_xx.clear()\n", + " if result[4] == m_min:\n", + " ii = ii\n", + " i = i+1\n", + " else:\n", + " i = i+1\n", + " ii = i\n", + " m_min = result[6]\n", + " \n", + " m_xx['pos'] = ii\n", + " m_xx['col_code'] = result[1]\n", + " m_xx['col_name'] = m_col[result[1]]\n", + " m_xx['spe_code'] = result[2]\n", + " m_xx['spe_name'] = m_spe[result[1]][result[2]]\n", + " m_xx['plan'] = result[3]\n", + " m_xx['num_min'] = result[4] \n", + " m_xx['rank_min'] = result[5]\n", + " m_xx['nian'] = '2021' \n", + " mycol1.insert_one(m_xx)\n", + " #print(m_xx)\n", + "print('ok')" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -176,7 +371,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "import pymysql\n", @@ -187,7 +384,7 @@ "mycol = mydb[\"college\"]\n", "m_xx = {}\n", "m_mongo = {}\n", - "db = pymysql.connect(\"localhost\",\"root\",\"songyi\",\"gaokao\" )\n", + "db = pymysql.connect(host = \"localhost\",user = \"root\",password = \"songyi\",database = \"gaokao\" )\n", "cursor = db.cursor()\n", "sql = 'SELECT college,SUM(num_dispense),min(num_min),max(RANK_min) FROM admission_2020 GROUP BY college'\n", "cursor.execute(sql)\n", @@ -436,7 +633,7 @@ { "cell_type": "markdown", "metadata": { - "toc-hr-collapsed": true, + "tags": [], "toc-nb-collapsed": true }, "source": [ @@ -503,8 +700,8 @@ "import openpyxl\n", "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", "mydb = myclient[\"gaokao\"]\n", - "mycol = mydb[\"college\"]\n", - "m_mongo = {\"code\":'Y022','name':'山东科技大学','charge':'山东省','city':'青岛市','grade':'本科','note':'校企合作,与青软实训教育科技股份有限公司'}\n", + "mycol = mydb[\"college_2021\"]\n", + "m_mongo = {\"code\":'H027','name':'北京师范大学(珠海校区)','charge':'教育部','city':'珠海市','grade':'本科','note':''}\n", "mycol.insert_one(m_mongo) \n", "print(m_mongo['name'] + '导入成功!')\n" ] @@ -512,7 +709,6 @@ { "cell_type": "markdown", "metadata": { - "toc-hr-collapsed": true, "toc-nb-collapsed": true }, "source": [ @@ -553,6 +749,262 @@ "db.close()\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 导入2021年录取数据" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 导出2021年录取数据并生成分数" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import openpyxl\n", + "import json\n", + "\n", + "filename = 'data/17-21年一分一段表.json'\n", + "with open(filename,'r') as fl:\n", + " m_xx = json.load(fl)\n", + "data = m_xx['2021']['z']\n", + "yfyd = {}\n", + "for k, v in data.items():\n", + " list1 = []\n", + " list1 = (v['min_rank'],v['max_rank'])\n", + " yfyd[k] = list1\n", + "dict1 = {}\n", + "filename = 'data/山东省2021年普通类常规批第1次志愿投档情况表.xlsx'\n", + "wb = openpyxl.load_workbook(filename)\n", + "sheet = wb.active\n", + "data1 =list(sheet.values)\n", + "del data1[0:2]\n", + "m_num = 1\n", + "i = 1\n", + "for items in data1:\n", + " m_rank = items[3]\n", + " list1 = []\n", + " for k, v in yfyd.items():\n", + " if m_rank >=v[1] and m_rank <=v[0]:\n", + " m_num = int(k)\n", + " break\n", + " list1 = (items[0],items[1],items[2],items[3],m_num)\n", + " dict1[i] = list1\n", + " i += 1 \n", + "with open('data/2021.json','w') as fl2:\n", + " json.dump(dict1,fl2) \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 2021年录取数据导入mysql数据库" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import pymysql\n", + "import json\n", + "\n", + "l_code = []\n", + "l_new = []\n", + "l_data = []\n", + "db = pymysql.connect(host = \"localhost\",user = \"root\",password = \"songyi\",database = \"gaokao\" )\n", + "cursor = db.cursor()\n", + "\n", + "sql = 'select code from college'\n", + "cursor.execute(sql)\n", + "results = cursor.fetchall()\n", + "for result in results:\n", + " l_code.append(result[0])\n", + "\n", + "with open('data/2021.json','r') as fl:\n", + " m_xx = json.load(fl)\n", + "for k, v in m_xx.items():\n", + " #code = v[1][:4]\n", + " l_data.append([v[1][:4],v[0][:2],v[2],v[4],v[3]])\n", + "\n", + "sql = \"insert into admission_2021 (college,speciality,plan,num_min,rank_min,nian) values(%s,%s,%s,%s,%s,'2021')\"\n", + "try:\n", + " cursor.executemany(sql,l_data)\n", + " db.commit()\n", + " print(\"已添加!\")\n", + "except:\n", + " # 如果发生错误则回滚\n", + " print(\"error!\")\n", + " db.rollback() \n", + "db.close() " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 整理2021年招生学校" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import pymysql\n", + "import json\n", + "\n", + "l_code = []\n", + "l_new = []\n", + "l_data = []\n", + "db = pymysql.connect(host = \"localhost\",user = \"root\",password = \"songyi\",database = \"gaokao\" )\n", + "cursor = db.cursor()\n", + "\n", + "sql = 'select code from college'\n", + "cursor.execute(sql)\n", + "results = cursor.fetchall()\n", + "for result in results:\n", + " l_code.append(result[0])\n", + "\n", + "with open('data/2021.json','r') as fl:\n", + " m_xx = json.load(fl)\n", + "for k, v in m_xx.items():\n", + " code = v[1][:4]\n", + " if code not in l_code:\n", + " l_code.append(code)\n", + " l_new.append([v[1][0:4],v[1][4:]])\n", + " #l_data.append([v[1][:4],v[0][:2],v[2],v[4],v[3]])\n", + "sql = \"insert into college (code,name) values(%s,%s)\"\n", + "try:\n", + " cursor.executemany(sql,l_new)\n", + " db.commit()\n", + " print(\"已添加!\")\n", + "except:\n", + " # 如果发生错误则回滚\n", + " print(\"error!\")\n", + " db.rollback() \n", + "db.close() " + ] + }, + { + "cell_type": "markdown", + "metadata": { + "execution": { + "iopub.execute_input": "2022-06-15T05:33:15.229612Z", + "iopub.status.busy": "2022-06-15T05:33:15.229087Z", + "iopub.status.idle": "2022-06-15T05:33:15.235612Z", + "shell.execute_reply": "2022-06-15T05:33:15.233803Z", + "shell.execute_reply.started": "2022-06-15T05:33:15.229565Z" + } + }, + "source": [ + "### 整理2021年新增招生学校" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import pymongo\n", + "import decimal\n", + "import json\n", + "\n", + "\n", + "myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n", + "mydb = myclient[\"gaokao\"]\n", + "mycol = mydb[\"college_2021\"]\n", + "mycol1 = mydb[\"admission_2020\"]\n", + "\n", + "m_col = {}\n", + "m_xx = {}\n", + "dict1 = {}\n", + "list1 = []\n", + "for x in mycol.find({\"code\":{'$exists': 'true'}},{\"_id\": 0, \"code\": 1, \"name\": 1}):\n", + " m_col[x['code']] = x['name']\n", + "\n", + "with open('data/2021.json','r') as fl:\n", + " m_xx = json.load(fl)\n", + "for k, v in m_xx.items():\n", + " #code = v[1][:4]\n", + " dict1[v[1][:4]]= v[1][4:]\n", + "for code in dict1.keys():\n", + " if code not in m_col.keys():\n", + " #print(dict1[code])\n", + " \n", + " if dict1[code] not in m_col.values():\n", + " list1.append(code)\n", + "print(list1)\n", + "for x in mycol.find({\"id_code\":{'$exists': 'true'}},{\"_id\": 0, \"id_code\": 1, \"name\": 1}):\n", + " m_col[x['id_code']] = x['name']\n", + "for code in list1:\n", + " if dict1[code] in m_col.values():\n", + " myquery = {'name':dict1[code]}\n", + " m_new = {\"$set\":{'code':code}}\n", + " mycol.update_one(myquery,m_new)\n", + " print(dict1[code])\n", + " #print(dict1[code])\n", + " \n", + " \n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 整理2021年新增专业" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import pymysql\n", + "import json\n", + "\n", + "l_data = []\n", + "db = pymysql.connect(host = \"localhost\",user = \"root\",password = \"songyi\",database = \"gaokao\" )\n", + "cursor = db.cursor()\n", + "\n", + "with open('data/2021.json','r') as fl:\n", + " m_xx = json.load(fl)\n", + "for k, v in m_xx.items():\n", + " l_data.append([v[0][:2],v[0][2:],v[1][0:4],'2021'])\n", + "sql = \"insert into speciality (code,name,college,nian) values(%s,%s,%s,%s)\"\n", + "try:\n", + " cursor.executemany(sql,l_data)\n", + " db.commit()\n", + " print(\"已添加!\")\n", + "except:\n", + " # 如果发生错误则回滚\n", + " print(\"error!\")\n", + " db.rollback() \n", + "db.close() " + ] + }, { "cell_type": "markdown", "metadata": { @@ -614,7 +1066,6 @@ { "cell_type": "markdown", "metadata": { - "toc-hr-collapsed": true, "toc-nb-collapsed": true }, "source": [ @@ -665,6 +1116,51 @@ "\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 导入2021年一分一段表" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "import openpyxl\n", + "import pymysql\n", + "import json\n", + "\n", + "m_xx = []\n", + "db = pymysql.connect(host = \"localhost\",user = \"root\",password = \"songyi\",database = \"gaokao\" )\n", + "cursor = db.cursor()\n", + "wb = openpyxl.load_workbook('./data/2021年一分一段表.xlsx')\n", + "sheet = wb.active\n", + "i = 1\n", + "for n in range(4,sheet.max_row):\n", + " m_score = sheet.cell(n,1).value\n", + " m_num = sheet.cell(n,2).value\n", + " m_sum = sheet.cell(n,3).value\n", + " m_max = m_sum - m_num + 1\n", + " m_xx.append((m_score,m_num,m_max,m_sum,'z','2021'))\n", + "#print(m_xx)\n", + "sql = 'insert into fenduan(score,per_num,max_rank,min_rank,category,nian) values (%s,%s,%s,%s,%s,%s)'\n", + "try:\n", + " cursor.executemany(sql,m_xx)\n", + " db.commit()\n", + " print(\"ok!\")\n", + "except:\n", + " # 如果发生错误则回滚\n", + " print(\"error!\")\n", + " db.rollback() \n", + "\n", + "db.close()" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -682,7 +1178,7 @@ "import json\n", "\n", "m_xx = {}\n", - "db = pymysql.connect(\"localhost\",\"root\",\"songyi\",\"gaokao\" )\n", + "db = pymysql.connect(host = \"localhost\",user = \"root\",password = \"songyi\",database = \"gaokao\" )\n", "cursor = db.cursor()\n", "sql = 'SELECT * FROM fenduan AS a ORDER BY nian,category'\n", "cursor.execute(sql)\n", @@ -695,7 +1191,7 @@ " m_xx[m_year][result[5]][result[1]]['num_person'] = result[2]\n", " m_xx[m_year][result[5]][result[1]]['max_rank'] = result[3]\n", " m_xx[m_year][result[5]][result[1]]['min_rank'] = result[4]\n", - "fl_name = 'data/17-20年一分一段表.json'\n", + "fl_name = 'data/17-21年一分一段表.json'\n", "with open(fl_name,'w') as fl:\n", " json.dump(m_xx,fl,ensure_ascii=False)\n", "print('ok!')\n" @@ -748,7 +1244,6 @@ { "cell_type": "markdown", "metadata": { - "toc-hr-collapsed": true, "toc-nb-collapsed": true }, "source": [ @@ -787,7 +1282,6 @@ { "cell_type": "markdown", "metadata": { - "toc-hr-collapsed": true, "toc-nb-collapsed": true }, "source": [ @@ -797,7 +1291,6 @@ { "cell_type": "markdown", "metadata": { - "toc-hr-collapsed": true, "toc-nb-collapsed": true }, "source": [ @@ -1282,458 +1775,9 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - "\n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - "\n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - "\n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - "\n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - "\n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - " \n", - " \n", - " \n", - "\n", - " \n", - "\n", - " \n", - "\n", - " \n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - " \n", - "\n", - "\n", - "\n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "ABOUT US | MOVE Sports Physio\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "
 
\"\"
\"Intro
\"Girl
\"Screen
\"trail

MOVE is a contemporary physiotherapy and rehabilitation

\n", - "\n", - "

practice situated in the heart of Ballito overlooking the rolling cane

\n", - "\n", - "

farms of The Dolphin Coast.

\n", - "\n", - "

 

\n", - "\n", - "

We provide a focussed and comprehensive service for people of all ages to have their aches, pains, sports injuries and post-operative rehabilitation performed under one roof. Our clients of all ages and abilities can’t help but feel comfortable and relaxed, whilst being professionally managed by qualified and experienced HPCSA-registered physiotherapists and biokineticists throughout the course of their recovery and rehabilitation.

\n", - "\n", - "

 

\n", - "\n", - "

Our mission is to develop our clients' understanding and greater ownership of their musculoskeletal condition in order to take back control of their health and wellbeing. All stakeholders can be assured of receiving evidence-based treatment and rehabilitation treatments and programmes.

\n", - "\n", - "

 

\n", - "\n", - "

We know how important it is for you to regain your health as quickly

\n", - "\n", - "

as possible, and in line with your own goals. Our extensive

\n", - "\n", - "

international experience and our own personal sports

\n", - "\n", - "

background make us the ideal place to get you

\n", - "\n", - "

‘back on track’ as quickly as possible.

Our Practice

\"Mountain
\"Screen

Meet The Team

\"Andrew

Andrew Leipus

Sports & Musculoskeletal Physiotherapist

Physiotherapist

\"Mieke

Kaitlin Holgate

Mieke Potgieter

Biokineticist / Sports & Therapeutic Massage

\"India

Musculoskeletal Physiotherapy

\n", - "\n", - "

Sports & Exercise Physiotherapy

\n", - "\n", - "

Orthopaedic Physiotherapy & Rehabilitation

\n", - "\n", - "

Injury Prevention & Screening

\n", - "\n", - "

Biomechanical & Movement Analysis

\n", - "\n", - "

Manual Therapies

\n", - "\n", - "

Exercise Rehabilitation

\n", - "\n", - "

Shockwave Therapy

\n", - "\n", - "

Hydrotherapy

\n", - "\n", - "

Sports Massage 

\n", - "\n", - "

Private Rehabilitation Gym

\n", - "\n", - "

Taping

\n", - "\n", - "

Needling

\n", - "\n", - "

Clinical Pilates

Our Services

\"Kait
\"HPCSA
\"SASMA
\"SPSA
\"SASP
\"APA_M_H_POS_CMYK.jpg\"
\"SASMA

COPYRIGHT ​© 2019 MOVE Sports Physio & Rehab, Ballito, South Africa

 
\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "import requests\n", "url = 'https://www.movephysio.co.za/'\n",