Skip to content

Commit

Permalink
Update 002_질본_현황크롤링.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
HarimJ committed Mar 18, 2020
1 parent 2154e89 commit c72e3cc
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions 002. korea_cumulative_data_crwler/002_질본_현황크롤링.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
}
],
"source": [
"import requests\n",
"from bs4 import BeautifulSoup\n",
"from urllib.request import urlopen\n",
"import urllib.request\n",
Expand Down Expand Up @@ -83,10 +84,48 @@
"tot.append(num)\n",
"tot = pd.DataFrame(tot)\n",
"\n",
"tot.rename(columns={tot.columns[0] : status[0],\n",
"tot1 = tot.rename(columns={tot.columns[0] : status[0],\n",
" tot.columns[1] : status[1],\n",
" tot.columns[2] : status[2],\n",
" tot.columns[3] : status[3]})"
" tot.columns[3] : status[3]})\n",
"\n",
"tot1"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# 크롤링 시간\n",
"url = 'http://ncov.mohw.go.kr/'\n",
"\n",
"response = requests.get(url)\n",
"soups = BeautifulSoup(response.content, 'html.parser')\n",
"\n",
"update_time = soups.find(\"span\", class_=\"livedate\").text"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"업데이트 시간 : (3.18. 00시 기준, 1.3 이후 누계)\n",
" 확진환자 격리해제 격리중 사망\n",
"0 8,413 1,540 6,789 84\n"
]
}
],
"source": [
"# 출력\n",
"print(\"업데이트 시간 : \",update_time)\n",
"print(tot1)"
]
}
],
Expand All @@ -106,7 +145,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.7.1"
}
},
"nbformat": 4,
Expand Down

0 comments on commit c72e3cc

Please sign in to comment.