본문 바로가기

Ankiwoong

(1835)
Python Basic 1. Python Setup Ver 확인1-1. Windows(명령 프롬프트)python --version1-2. Mac(터미널)python3 --version 2. Python Site2-1. Python 공식 사이트 : https://www.python.org/2-2. Python Code 확인 : http://pythontutor.com/ 3. Python Setup Option3-1. Install launcher for all users / Add Python 3.7 to PATH 4. Python Run4-1. Windows(명령 프롬프트)python4-2. MAC(터미널)python3 5. Python extension.py 6. Python Code Run6-1. Windows(명령 프롬프..
Pandas Module CSV Read 1. Modulefrom pandas import read_csv 2. CSV File Load -> Pandas Data Framedataframe = read_csv('데이터경로', encoding='인코딩방식')인코딩방식 : ecu-kr / utf-8 3. Pandas Data Frame -> CSV File Savedataframe.to_csv('저정경로', encoding='인코딩방식', na_rep='결측치에할당문자', index=True|False, index_label='컬럼명', header=[csv의 컬럼명으로 사용할 리스트])na_rep : 기본값 빈 문자열 / index : True -> Index가 CSV File 저장, False -> Index가 CSV File 저장안됨Inde..
Chinese Character WordCloud Python Code>from wordcloud import WordCloud from matplotlib import pyplot from collections import Counter from PIL import Image import numpy text = '' with open("데이터위치", encoding="utf-8") as f: text = f.read(); tmp = list(text) hanja = [] ignore = [" ", "\n", ",", ".", "(", ")", "\U000f0703", "\ufeff"] for item in tmp: if item not in ignore: hanja.append(item.strip()) count = Counter(hanja) most..
KoNLpy Korean WordCloud Code>from wordcloud import WordCloud from matplotlib import pyplot from collections import Counter from konlpy.tag import Okt text = '' with open("파일경로", encoding="utf-8") as f: text = f.read() nlp = Okt() nouns = nlp.nouns(text) words = [] for n in nouns: if len(n) > 1: words.append(n) count = Counter(words) most = count.most_common(100) tags = {} for n, c in most: tags[n] = c wc = WordCloud(ba..
KoNLpy KoNLpy는 한글 형태소 분석에 쓰이는 오픈소스이다. KoNLpy를 Windows에서 사용할려면 두가지 전제 조건이 필요하다. 1. JAVA 개발환경 설치 2. C++ 개발환경 설치 JAVA 환경은 https://developer-ankiwoong.tistory.com/108를 참조한다. C++ 환경은 Microsoft Visual C++ Build Tools를 사용하는데 버전이 여러개 존재하나 KoNLpy를 사용할려면 14.0.25420.1을 사용하면 된다. 위에 두가지 환경을 다 설치 하였다면 이제 KoNLpy를 설치 하면 된다. 1. 시작 > 실행 > 명령 프롬프트 2. pip install konlpy 설치 에러시 JAVA 환경 설정 또는 Visual C++ Tools에 버전이 안맞아 발생하는 ..
KoNLpy JAVA Environment Variable Error Dissolvent 1. 자바 개발 환경 설치 여부 확인 1-1. 시작 > 실행 > 명령 프롬프트 1-2. javac -version 1-3. JAVA 버전이 나오는지 확인한다. 에러 창이 뜰 시 설치가 안되있는 경우이다. 2. JAVA 개발 환경 설치 2-1. 구글에 jdk-8u181-windows-x64를 검색하여 설치한다. 3. JAVA 개발 환경 변수 설정 3-1. 제어판 > 모든 제어판 항목 > 시스템 > 고급 시스템 설정 3-2. 환경변수 3-3. 시스템 변수 > 새로 만들기 3-3-1. 변수이름 : JAVA_HOME / 변수 값 : C:\Program Files\Java\jdk1.8.0_181 3-4. 시스템 변수 > Path > 편집 > 새로만들기 3-4-1. %JAVA_HOME%bin 4. 시스템 재시작
WordCloud Font HSL Color Code 1>from wordcloud import WordCloud from matplotlib import pyplot def make_colors(word, font_size, position, orientation, random_state, **kwargs): color = "hsl Color Code" return color text = '' with open("파일경로", encoding="utf-8") as f: text = f.read() wc = WordCloud(width=1200, height=800, scale=2.0, max_font_size=150, background_color="#ffffff") gen = wc.generate(text) recolor = gen.recolor..
WordCloud Font RGB Color Code 1>from wordcloud import WordCloud from matplotlib import pyplot def make_colors(word, font_size, position, orientation, random_state, **kwargs): color = "rgb(0, 0, 0)" return color text = '' with open("파일경로명", encoding="utf-8") as f: text = f.read() wc = WordCloud(width=1200, height=800, scale=2.0, max_font_size=150, background_color="#ffffff") gen = wc.generate(text) recolor = gen.recolor(..