Skip to content

Commit

Permalink
질병관리본부 업데이트 검사자수,
Browse files Browse the repository at this point in the history
  • Loading branch information
GinajiyoungSong committed Mar 22, 2020
1 parent b3acaba commit 44fed5c
Show file tree
Hide file tree
Showing 2 changed files with 224 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "test_active_negative_crawling",
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "v-DZKeAnbW-g",
"colab_type": "text"
},
"source": [
""
]
},
{
"cell_type": "code",
"metadata": {
"id": "WJsSNx3FbUr_",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 116
},
"outputId": "45be0090-2309-48e1-f735-99ab94c6b7b7"
},
"source": [
"from bs4 import BeautifulSoup\n",
"from urllib.request import urlopen\n",
"import urllib.request\n",
"import pandas as pd\n",
"\n",
"html = urlopen(\"http://ncov.mohw.go.kr/bdBoardList_Real.do?brdId=1&brdGubun=11&ncvContSeq=&contSeq=&board_id=&gubun=\")\n",
"source = html.read()\n",
"html.close()\n",
"\n",
"soup = BeautifulSoup(source, 'lxml')\n",
"table = soup.find(\"div\", class_ = \"data_table mgt16 mini\")\n",
"tables1 = table.find_all(\"th\")\n",
"tables2 = table.find_all(\"td\")\n",
"#print(tables1)\n",
"\n",
"\n",
"col = [\"isolated\",\"released\",\"deceased\",\"confirmed\",\"negative\",\"test-active\",\"active\",\"test\"]\n",
"print(col)\n",
"\n",
"\n",
"num=[]\n",
"for i in range(0, len(tables2)) :\n",
" a = tables2[i].get_text()\n",
" num.append(a)\n",
" \n",
"print(num)\n",
"\n",
"test_status = []\n",
"test_status.append(num)\n",
"test_status = pd.DataFrame(test_status)\n",
"\n",
"test_status =test_status.rename(columns = {test_status.columns[0]: col[0],\n",
" test_status.columns[1]: col[1],\n",
" test_status.columns[2]: col[2],\n",
" test_status.columns[3]: col[3],\n",
" test_status.columns[4]: col[4],\n",
" test_status.columns[5]: col[5],\n",
" test_status.columns[6]: col[6],\n",
" test_status.columns[7]: col[7]})\n",
"\n",
"test_status = pd.DataFrame(test_status, columns=['test','active','negative','confirmed',\n",
" 'released','isolated','deceased'])\n",
"test_status"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"['isolated', 'released', 'deceased', 'confirmed', 'negative', 'test-active', 'active', 'test']\n",
"['5,884', '2,909', '104', '8,897', '308,343', '317,240', '14,540', '331,780']\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>test</th>\n",
" <th>active</th>\n",
" <th>negative</th>\n",
" <th>confirmed</th>\n",
" <th>released</th>\n",
" <th>isolated</th>\n",
" <th>deceased</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>331,780</td>\n",
" <td>14,540</td>\n",
" <td>308,343</td>\n",
" <td>8,897</td>\n",
" <td>2,909</td>\n",
" <td>5,884</td>\n",
" <td>104</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" test active negative confirmed released isolated deceased\n",
"0 331,780 14,540 308,343 8,897 2,909 5,884 104"
]
},
"metadata": {
"tags": []
},
"execution_count": 1
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "exiALa_4bXcR",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}
61 changes: 61 additions & 0 deletions 005. korea_Test_active_negative_crawl/time_brifing.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
date,test,active,negative,confirmed,released,isolated,deceased
2020-01-23,22,1,21,1,0,1,0
2020-01-24,27,0,25,2,0,2,0
2020-01-25,27,0,25,2,0,2,0
2020-01-26,51,1,47,3,0,3,0
2020-01-27,61,1,56,4,0,4,0
2020-01-28,116,15,97,4,0,4,0
2020-01-29,187,28,155,4,0,4,0
2020-01-30,244,41,199,4,0,4,0
2020-01-31,312,56,245,11,0,11,0
2020-02-01,371,70,289,12,0,12,0
2020-02-02,429,87,327,15,0,15,0
2020-02-03,490,61,414,15,0,15,0
2020-02-04,607,129,462,16,0,16,0
2020-02-05,714,174,522,18,0,18,0
2020-02-06,485,169,293,23,1,22,0
2020-02-07,1130,264,842,24,1,23,0
2020-02-08,1701,620,1057,24,2,22,0
2020-02-09,2340,960,1355,25,3,24,0
2020-02-10,2776,809,1940,27,3,22,0
2020-02-11,3629,865,2736,28,4,24,0
2020-02-12,5074,992,4054,28,4,24,0
2020-02-13,5797,670,5099,28,7,21,0
2020-02-14,6854,692,6134,28,7,21,0
2020-02-15,7519,638,6853,28,9,19,0
2020-02-16,7919,577,7313,29,9,20,0
2020-02-17,8171,408,7733,30,9,21,0
2020-02-18,9265,957,8277,31,10,21,0
2020-02-19,10411,1030,9335,46,12,34,1
2020-02-20,12161,1633,10446,82,16,66,1
2020-02-21,14816,2707,11953,156,16,139,1
2020-02-22,19621,5481,13794,346,17,327,2
2020-02-23,22633,6039,16038,556,18,534,4
2020-02-24,28615,8725,19127,763,18,738,7
2020-02-25,36716,13273,22550,893,22,863,8
2020-02-26,46127,16734,28247,1146,22,1113,11
2020-02-27,57990,21097,35298,1595,24,1559,12
2020-02-28,70940,24751,44167,2022,26,1983,13
2020-02-29,85693,29154,53608,2931,27,2888,16
2020-03-01,96985,32422,61037,3526,30,3479,17
2020-03-02,98921,33360,61825,3736,30,3684,22
2020-03-03,125851,35555,85484,4812,34,4750,28
2020-03-04,136707,28414,102965,5328,41,5255,32
2020-03-05,146541,21810,118965,5766,88,5643,35
2020-03-06,164740,21832,136624,6284,108,6134,42
2020-03-07,178189,19620,151802,6767,118,6605,44
2020-03-08,188518,19376,162008,7134,130,6954,50
2020-03-09,196618,17458,171778,7382,166,7165,51
2020-03-10,210144,18452,184179,7513,247,7212,54
2020-03-11,222395,18540,196100,7755,288,7407,60
2020-03-12,234998,17727,209402,7869,333,7470,66
2020-03-13,248647,17940,222728,7979,410,7402,67
2020-03-14,261335,17634,235615,8086,714,7300,72
2020-03-15,268212,16272,243778,8162,834,7253,75
2020-03-16,274504,14971,251297,8236,1137,7024,75
2020-03-17,286716,17291,261105,8321,1401,6838,81
2020-03-18,295647,16346,270888,8413,1540,6789,84
2020-03-19,307024,15904,282555,8565,1947,6527,91
2020-03-20,316664,15525,292487,8652,2233,6325,94
2020-03-21,327509,15704,303006,8799,2612,6085,102
2020-03-22,331780,14540,308343,8897,2909,5884,104

0 comments on commit 44fed5c

Please sign in to comment.