Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions 02_개정판/7_Best_Product/7_1&2_Crawling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
" spec_list = prod_item.select('div.spec_list')[0].text.strip()\n",
" # ③ 가격 정보 가져오기 \n",
" price = prod_item.select('li.rank_one > p.price_sect > a > strong')[0].text.strip().replace(\",\", \"\")\n",
" price = int(price) # 문자열 => 숫자형 변환\n",
" prod_data.append([title, spec_list, price])\n",
" except:\n",
" pass # 진행시 에러가 발생할 경우(광고 상품 등) 넘어가기\n",
Expand All @@ -159,6 +160,7 @@
" spec_list = prod_item.select('div.spec_list')[0].text.strip()\n",
" # ③ 가격 정보 가져오기\n",
" price = prod_item.select('li.rank_one > p.price_sect > a > strong')[0].text.strip().replace(\",\", \"\")\n",
" price = int(price) # 문자열 => 숫자형 변환\n",
" prod_data.append([title, spec_list, price])\n",
" except:\n",
" pass # 진행시 에러가 발생할 경우(광고 상품 등) 넘어가기\n",
Expand Down Expand Up @@ -363,6 +365,11 @@
"outputs": [],
"source": [
"# 예제 7-19 첫 번째 제품의 스펙 목록 분리\n",
"\n",
"# 스펙 목록에서 탭과 개행 문자를 제거하는 코드를 상단에 추가 \n",
"data['스펙 목록'] = data['스펙 목록'].str.replace('\\t', '')\n",
"data['스펙 목록'] = data['스펙 목록'].str.replace('\\n', '')\n",
"\n",
"spec_list = data['스펙 목록'][0].split(' / ')\n",
"spec_list "
]
Expand Down
5 changes: 5 additions & 0 deletions 02_개정판/7_Best_Product/7_3_preprocessing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
"outputs": [],
"source": [
"# 예제 7-19 첫 번째 제품의 스펙 목록 분리\n",
"\n",
"# 스펙 목록에서 탭과 개행 문자를 제거하는 코드를 상단에 추가 \n",
"data['스펙 목록'] = data['스펙 목록'].str.replace('\\t', '')\n",
"data['스펙 목록'] = data['스펙 목록'].str.replace('\\n', '')\n",
"\n",
"spec_list = data['스펙 목록'][0].split(' / ')\n",
"spec_list "
]
Expand Down
2 changes: 1 addition & 1 deletion 02_개정판/7_Best_Product/7_4_Product_Analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down