목록Data Engineering/Web Scraping (3)
공부하자
123456789101112131415import seaborn as snsimport matplotlib.pyplot as plt # 꺾은선 그래프plt.figure(figsize=(20, 10))sns.lineplot(x=[1, 3, 2, 4], y=[4, 3, 2, 1])plt.ylim(0, 10)plt.show() # 막대 그래프sns.barplot(x=['A', 'B', 'C', 'D'], y = [1, 2, 4, 3]) plt.title("Bar Plot")plt.xlabel("X Label")plt.ylabel("Y Label")plt.show()Colored by Color Scriptercs
0. 설치pip3 install seleniumpip3 install webdriver-manager 1. 예제 코드123456789101112from selenium import webdriverfrom selenium.webdriver.chrome.service import Servicefrom webdriver_manager.chrome import ChromeDriverManagerfrom selenium.webdriver.common.by import By driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))driver.get('http://example.com') with webdriver.Chrome(servi..
파이썬에서 HTML 문서를 파싱하고 데이터를 추출하는데 사용되는 라이브러리 0. 설치pip3 install requests 1. 예제 코드12345678910111213141516import requestsfrom bs4 import BeautifulSoup # www.example.com 사이트를 요청한 후 응답 받아보기res = requests.get("https://www.example.com")res.text # BeautifulSoup 객체 생성soup = BeautifulSoup(res.text, "html.parser") # .prettify() 로 분석된 HTML 을 보기 좋게 반환print(soup.prettify()) # 특정 요소 접근 가능h1 = soup.find("h1")print..