20220524
This commit is contained in:
1 parent
272d2ebbb3
commit
803a0c5690
2 files changed
+83
-56
No files matched your search
+2
-51
@@ -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",
|
||||
|
||||
+81
-5
@@ -665,6 +665,66 @@
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### 导入2021年一分一段表"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-05-24T10:20:31.546520Z",
|
||||
"iopub.status.busy": "2022-05-24T10:20:31.546005Z",
|
||||
"iopub.status.idle": "2022-05-24T10:20:31.760806Z",
|
||||
"shell.execute_reply": "2022-05-24T10:20:31.759535Z",
|
||||
"shell.execute_reply.started": "2022-05-24T10:20:31.546476Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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": {},
|
||||
@@ -674,15 +734,31 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2022-05-24T10:23:05.570230Z",
|
||||
"iopub.status.busy": "2022-05-24T10:23:05.569724Z",
|
||||
"iopub.status.idle": "2022-05-24T10:23:05.703267Z",
|
||||
"shell.execute_reply": "2022-05-24T10:23:05.702038Z",
|
||||
"shell.execute_reply.started": "2022-05-24T10:23:05.570184Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok!\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import pymysql\n",
|
||||
"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 +771,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"
|
||||
|
||||
Reference in new issue
Block a user