전체 글 (61) 썸네일형 리스트형 생소한 판다스 표현 한글데이터를 판다스로 받기 DataUrl = 'https://raw.githubusercontent.com/Datamanim/pandas/main/Jeju.csv' df = pd.read_csv(DataUrl,encoding='euc-kr') 수치형 변수출력 df.select_dtypes(exclude=object).columns 범주형 변수 출력 Ans = df.select_dtypes(include=object).columns 데이터컬럼의 통계 출력하기 df.describe() IQR구하기 df['평균 속도'].quantile(0.75) -df['평균 속도'].quantile(0.25) 특정컬럼의 값이 3인 경우의 상위 5개 출력 df.loc[df['quantity']==3].head() 위의 행렬을.. 수프 크롤링 2탄 from urllib.request import urlopen from bs4 import BeautifulSoup url = "https://ai-dev.tistory.com/1?category=836119" html = urlopen(url) #print(html.read()) #전체 html보는 방법 bs_obj = BeautifulSoup(html, "html.parser") # 제목 추출 title = bs_obj.find_all("h1") print(title) print(title[1]) print(title[1].text) # 본문 내용 추출 contents = bs_obj.find_all("p") #양쪽에 p를 남겨둔형태 print(contents) # 그중에 하나만 가져오기 print(.. 수프 크롤링 사용할 라이브 러리 from bs4 import BeautifulSoup html생성 html_doc = """ 크롤링을 해봅시다. """ 해드 탐색 bs_obj = BeautifulSoup(html_doc, "html.parser") head = bs_obj.find("head") print(head) 바디 탐색 body = bs_obj.find("body") print(body) html 새로 지정 html_doc = """ 첫 번째 부분 두 번째 부분 """ body부분 전체 출력 bs_obj = BeautifulSoup(html_doc, "html.parser") body = bs_obj.find("body") print(body) div부분 추출 첫번째만 추출됨 div1 = bs_obj.find.. 이전 1 2 3 4 5 6 7 ··· 21 다음