본문 바로가기
반응형

Python/데이터 과학 기반의 파이썬 빅데이터 분석(한빛 아카데미)10

데이터 과학 기반의 파이썬 빅데이터 분석 Chapter13 텍스트 마이닝 01 [감성 분석 + 토픽 모델링] 영화 리뷰 데이터로 감성 예측하기 데이터 준비 및 탐색 pandas 버전 확인하기 import pandas as pd pd.show_versions() INSTALLED VERSIONS ------------------ commit : 66e3805b8cabe977f40c05259cc3fcf7ead5687d python : 3.8.16.final.0 python-bits : 64 OS : Linux OS-release : 5.10.147+ Version : #1 SMP Sat Dec 10 16:00:40 UTC 2022 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UT.. 2023. 1. 11.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter12 군집분석 01 [평균 군집화 분석 + 그래프] 타깃 마케팅을 위한 소비자 군집 분석하기 import pandas as pd import math retail_df = pd.read_excel('/content/Online_Retail.xlsx') retail_df.head() 데이터 정제하기 retail_df.info() Int64Index: 536641 entries, 0 to 541908 Data columns (total 8 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 InvoiceNo 536641 non-null object 1 StockCode 536641 non-null object 2 Description 5351.. 2023. 1. 10.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter11 분류 분석 01 [로지스틱 회귀 분석] 특징 데이터로 유방암 진단하기 사이킷런 의 유방암 진단 데이터셋 사용하기 import numpy as np import pandas as pd from sklearn.datasets import load_breast_cancer b_cancer = load_breast_cancer() print(b_cancer.DESCR) .. _breast_cancer_dataset: Breast cancer wisconsin (diagnostic) dataset -------------------------------------------- **Data Set Characteristics:** :Number of Instances: 569 :Number of Attributes: 30 n.. 2023. 1. 10.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter10 회귀 분석 01 [선형 회귀 분석 + 산점도/선형 회귀 그래프] 환경에 따른 주택 가격 예측하기 !pip install sklearn Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Collecting sklearn Downloading sklearn-0.0.post1.tar.gz (3.6 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: sklearn Building wheel for sklearn (setup.py) ... done Created wheel for sklearn: file.. 2023. 1. 9.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter09 지리 정보 분석 01 [주소 데이터 분석 + 지오맵] 지리 정보 분석 후 맵 생성하기 import pandas as pd CB = pd.read_csv('CoffeeBean.csv', encoding = 'CP949', index_col = 0, header = 0, engine = 'python') CB.head() #작업 내용 확인용 출력 addr = [] for address in CB.address: addr.append(str(address).split()) addr #작업 내용 확인용 출력 [['서울시', '강남구', '학동로', '211', '1층'], ['서울시', '강남구', '광평로', '280', '수서동', '724호'], ['서울시', '강남구', '논현로', '566', '강남차병원1층'], [.. 2023. 1. 9.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter08 텍스트 빈도 분석 01 [영문 분석 + 워드클라우드] 영문 문서 제목의 키워드 분석하기 !pip install matplotlib !pip install wordcloud !pip install nltk Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Requirement already satisfied: matplotlib in /usr/local/lib/python3.8/dist-packages (3.2.2) Requirement already satisfied: numpy>=1.11 in /usr/local/lib/python3.8/dist-packages (from matplotlib) .. 2023. 1. 8.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter07 통계분석 01 [기술 통계 분석 + 그래프] 와인 품질 등급 예측하기 from google.colab import files uploaded = files.upload() winequality-red.csv winequality-red.csv(text/csv) - 84199 bytes, last modified: 2023. 1. 7. - 100% done Saving winequality-red.csv to winequality-red.csv uploaded = files.upload() winequality-white.csv winequality-white.csv(text/csv) - 264426 bytes, last modified: 2023. 1. 7. - 100% done Saving winequality.. 2023. 1. 8.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter06 파이썬 크롤링 - 라이브러리 이용 정적 웹 페이지 크롤링 준비 1.1 BeautifulSoup 연습하기 1 from bs4 import BeautifulSoup 연습용 html 작성 html = '한빛출판네트워크로그인한빛미디어한빛아카데미' BeutifulSoup 객체 생성 soup = BeautifulSoup(html, 'html.parser') 객체에 저장된 html 내용 확인 print(soup.prettify()) 한빛출판네트워크 로그인 한빛미디어 한빛아카데미 1.2 BeautifulSoup 연습하기 2 태그 파싱하기: 지정된 한 개의 태그만 파싱 한다. soup.h1 한빛출판네트워크 tag_h1 = soup.h1 tag_h1 한빛출판네트워크 tag_div = soup.div tag_div 로그인한빛미디어ul.brand>li") l.. 2023. 1. 6.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter05 파이썬 크롤링-API 이용 01. 네이버 API를 이용한 크롤링 [CODE 0] 먼저, 전체 작업 스토리를 설계한다. def main(): node = 'news' #크롤링할 대상 srcText = input('검색어를 입력하세요: ') cnt = 0 jsonResult = [] jsonResponse = getNaverSearch(node, srcText, 1, 100) #[CODE 2] total = jsonResponse['total'] while ((jsonResponse != None) and (jsonResponse['display'] != 0)): for post in jsonResponse['items']: cnt += 1 getPostData(post, jsonResult, cnt) #[CODE 3] start =.. 2023. 1. 5.
데이터 과학 기반의 파이썬 빅데이터 분석 Chapter04 파이썬 프로그래밍 기초 연습문제 07. pandas의 DataFrame 자료형으로 저장한 뒤 CSV파일에 저장하시오. import pandas as pd df = pd.DataFrame([[500, 450, 520, 610], [690, 700, 820, 900], [1100, 1030, 1200, 1380], [1500, 1650, 1700, 1850], [1990, 2020, 2300, 2420], [1020, 1600, 2200, 2550]], index = ['2015', '2016', '2017', '2018', '2019', '2020'], columns = ['1분기', '2분기', '3분기', '4분기']) df df.to_csv('Users', header = 'False') 08. 07번의 데이터를 이용하여 연도별 라.. 2023. 1. 5.
반응형