This commit is contained in:
512song@sina.com committed 2023-08-11 07:43:01 +08:00
1 parent 8e449c63b3
commit 24a9839483
2 files changed
+270 -29

No files matched your search

+83 -12
View File
@@ -18,10 +18,46 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"id": "be2371be-89f5-4879-82a9-4a1d9e6376d3",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2023-07-03T13:57:31.935033Z",
"iopub.status.busy": "2023-07-03T13:57:31.934515Z",
"iopub.status.idle": "2023-07-03T13:57:31.994646Z",
"shell.execute_reply": "2023-07-03T13:57:31.993752Z",
"shell.execute_reply.started": "2023-07-03T13:57:31.934988Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 西北工业大学 计算机类(卓越班) 4046\n",
"2 厦门大学 计算机类 4369\n",
"3 北京交通大学 计算机类 4571\n",
"4 四川大学 计算机类 4583\n",
"5 西南交通大学 计算机类 4851\n",
"6 山东大学 计算机类(计算机与智能方向) 5486\n",
"7 西北工业大学 计算机类 5506\n",
"8 中南大学 计算机类(计算机信息类) 5632\n",
"9 湖南大学 计算机科学与技术(拔尖实验班) 5793\n",
"10 中国农业大学 计算机类 5808\n",
"11 大连理工大学 电子信息类(电信、自动化与计算机工科实验班) 6303\n",
"12 北京科技大学 计算机类 6789\n",
"13 山东大学 计算机类(软件数媒与大数据方向) 7425\n",
"14 重庆大学 计算机类(计算机与软件) 7581\n",
"15 南京航空航天大学 计算机科学与技术 7943\n",
"16 湖南大学 计算机科学与技术 8062\n",
"17 西安电子科技大学 计算机类 8528\n",
"18 湖南大学 计算机科学与技术(智能班) 8702\n",
"19 吉林大学 计算机类 8724\n",
"20 哈尔滨工业大学(威海) 计算机类 8895\n"
]
}
],
"source": [
"import pymongo\n",
"import re\n",
@@ -30,9 +66,9 @@
"mydb = myclient[\"gaokao\"]\n",
"mycol = mydb[\"admission_2020\"]\n",
"\n",
"m_zhuanye = '医学'\n",
"m_rank1 = 11000\n",
"m_rank2 = 15000\n",
"m_zhuanye = '计算机'\n",
"m_rank1 = 4000\n",
"m_rank2 = 9000\n",
"\n",
"myquery = {'spe_name':re.compile(m_zhuanye),'rank_min':{\"$gte\": m_rank1,\"$lte\": m_rank2}}\n",
"i = 1\n",
@@ -51,20 +87,47 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 51,
"id": "07dbb641-d594-4c7c-92da-045a5370e6e9",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2023-06-28T02:27:08.902334Z",
"iopub.status.busy": "2023-06-28T02:27:08.901812Z",
"iopub.status.idle": "2023-06-28T02:27:08.944814Z",
"shell.execute_reply": "2023-06-28T02:27:08.943941Z",
"shell.execute_reply.started": "2023-06-28T02:27:08.902286Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 北京师范大学 历史学类 639\n",
"2 南开大学 历史学类 634\n",
"3 四川大学 历史学类 633\n",
"4 华东师范大学 历史学 632\n",
"5 中山大学 历史学(广州) 630\n",
"6 中国社会科学院大学 历史学 622\n",
"7 湖南大学 历史学 618\n",
"8 山东大学 历史学类 616\n",
"9 华中师范大学 历史学类 615\n",
"10 中央民族大学 历史学类 614\n",
"11 南京师范大学 历史学类 607\n"
]
}
],
"source": [
"import pymongo\n",
"import re\n",
"\n",
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
"mydb = myclient[\"gaokao\"]\n",
"mycol = mydb[\"admission_2020\"]\n",
"mycol = mydb[\"admission_2022\"]\n",
"\n",
"m_zhuanye = '医学'\n",
"m_fenshu = 600\n",
"m_zhuanye = '历史'\n",
"m_fenshu = 607\n",
"\n",
"myquery = {'spe_name':re.compile(m_zhuanye),'num_min':{\"$gte\": m_fenshu}}\n",
"i = 1\n",
@@ -72,6 +135,14 @@
" print(i,x['col_name'],x['spe_name'],x['num_min'])\n",
" i += 1\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1778e718-d258-4a53-bb14-f82e09211fb7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
+187 -17
View File
@@ -1299,26 +1299,11 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": null,
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-04T03:53:00.735786Z",
"iopub.status.busy": "2022-08-04T03:53:00.735257Z",
"iopub.status.idle": "2022-08-04T03:53:10.194351Z",
"shell.execute_reply": "2022-08-04T03:53:10.192776Z",
"shell.execute_reply.started": "2022-08-04T03:53:00.735737Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"outputs": [],
"source": [
"import pymysql\n",
"import pymongo\n",
@@ -1376,6 +1361,191 @@
"print('ok')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 导入2023年录取数据"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 导入2023年一分一段表"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"\n",
"wb = openpyxl.load_workbook('./data/2023年一分一段表.xlsx')\n",
"sheet = wb.active\n",
"i = 1\n",
"dict1 = {}\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",
" dict1[m_score] = {'num_person':m_num,'max_rank':m_max,'min_rank':m_sum}\n",
"filename = 'data/2023年一分一段表.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict1,fl) \n"
]
},
{
"cell_type": "markdown",
"metadata": {
"execution": {
"iopub.execute_input": "2023-07-26T13:07:34.650896Z",
"iopub.status.busy": "2023-07-26T13:07:34.650369Z",
"iopub.status.idle": "2023-07-26T13:07:34.656873Z",
"shell.execute_reply": "2023-07-26T13:07:34.655204Z",
"shell.execute_reply.started": "2023-07-26T13:07:34.650847Z"
}
},
"source": [
"### 导出2023年录取数据并生成分数"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import openpyxl\n",
"import json\n",
"\n",
"filename = 'data/2023年一分一段表.json'\n",
"with open(filename,'r') as fl:\n",
" m_xx = json.load(fl)\n",
"\n",
"for k, v in m_xx.items():\n",
" list1 = []\n",
" list1 = (v['min_rank'],v['max_rank'])\n",
" yfyd[int(k)] = list1\n",
"dict1 = {}\n",
"filename = 'data/山东省2023年普通类常规批第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",
" print(items[0])\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/2023.json','w') as fl2:\n",
" json.dump(dict1,fl2) \n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2023年专业录取分数及位次"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"execution": {
"iopub.execute_input": "2023-07-26T14:40:10.969625Z",
"iopub.status.busy": "2023-07-26T14:40:10.969096Z",
"iopub.status.idle": "2023-07-26T14:40:29.882965Z",
"shell.execute_reply": "2023-07-26T14:40:29.881763Z",
"shell.execute_reply.started": "2023-07-26T14:40:10.969577Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n",
"ok\n"
]
}
],
"source": [
"import json\n",
"import pymongo\n",
"import decimal\n",
"\n",
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
"mydb = myclient[\"gaokao\"]\n",
"mycol1 = mydb[\"admission_ls\"]\n",
"mycol = mydb[\"admission_2023\"]\n",
"\n",
"m_col = {}\n",
"m_spe = {}\n",
"m_xx = {}\n",
"filename = 'data/2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"for k, v in dict1.items():\n",
" m_xx = {}\n",
" m_xx['col_code'] = v[1][:4]\n",
" m_xx['col_name'] = v[1][4:]\n",
" m_xx['spe_code'] = v[0][:2]\n",
" m_xx['spe_name'] = v[0][2:]\n",
" m_xx['plan'] = v[2]\n",
" m_xx['num_min'] = v[4] \n",
" m_xx['rank_min'] = v[3]\n",
" m_xx['nian'] = '2023'\n",
" mycol1.insert_one(m_xx)\n",
" #print(m_xx)\n",
"print('ok')\n",
"mydoc = mycol1.find().sort(\"rank_min\")\n",
"i = 1 \n",
"for x in mydoc:\n",
" m_xx = {}\n",
" m_xx['pos'] = i\n",
" m_xx['col_code'] = x['col_code']\n",
" m_xx['col_name'] = x['col_name'] \n",
" m_xx['spe_code'] = x['spe_code']\n",
" m_xx['spe_name'] = x['spe_name']\n",
" m_xx['plan'] = x['plan']\n",
" m_xx['num_min'] = x['num_min']\n",
" m_xx['rank_min'] = x['rank_min']\n",
" m_xx['nian'] = '2023'\n",
" mycol.insert_one(m_xx)\n",
" i+=1\n",
"print('ok') "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {