[TIL] 23.03.06

문종현·2023년 3월 6일
0

TIL

목록 보기
89/119

급성충수염으로 인해 수술을 마치고 이제 퇴원을 마쳤다.. 다행히 회복 속도가 빨라 책 집필이나 예정되었던 일정들에 영향을 미치지는 않을 것 같다!

👉 오늘 한 일

  • 원티드 프리온보딩 데이터 챌린지 세션

프리온보딩 챌린지

프리온보딩 챌린지 ? : 원티드에서 주관하는 데이터 챌린지 세션으로 원티드의 데이터 분석가 공고를 빅쿼리를 통해 전처리하고, Python을 통해 시각화 하는 등 프로덕트 분석가의 업무를 체험해보고, 상금을 통해 취업을 지원해주는 프로그램

DB 샤딩 : 특정 기준으로 테이블을 자르는 것 -> 파티션 설정

빅쿼리에서 데이터 전처리

  • SPLITsafe_offset() 으로 한 개 인스턴스 내에서 조건, 인덱스에 따라 잘라낼 수 있음
SELECT 
position_id
, position
-- 주요 업무만 나오게 하기
, SPLIT(SPLIT(jd, '주요업무')[safe_offset(1)],'자격요건')[safe_offset(0)] AS respoinsibilities
-- 자격 요건만 나오게 하기
, SPLIT(SPLIT(jd, '주요업무')[safe_offset(1)],'자격요건')[safe_offset(1)], '우대사항')[safe_offset(0)] AS requirement 
-- 혜택 및 복지만 나오게 하기
, SPLIT(SPLIT(jd, '주요업무')[safe_offset(1)],'자격요건')[safe_offset(1)], '우대사항')[safe_offset(1)], '혜택 및 복지')[safe_offset(0)] AS preference
, annual_from
, annual_to
-- 최소, 최대 연차를 담은 1차원 배열 생성
, GENERATE_ARRAY(annual_from, annual_to, 1) as target_annual
FROM wanted_data_challenge.wanted_position
  • 빅쿼리에서 전처리한 데이터는 colab 노트북으로 탐색 버튼을 통해 colab으로 넘겨받을 수 있음 (colab에서 알아서 setup)

  • 기본적으로 데이터프레임과 describe()를 제공한 상태에서 넘겨줌

colab으로 넘어와서 시각화(워드클라우드) 진행

# 필요 패키지 다운
!pip install krwordrank

# 라이브러리 로드
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from krwordrank.word import KRWordRank

# 빅쿼리에서 가져온 테이블(results)을 복사
df = results.copy()
df['responsibilities'] = df['responsibilities'].replace(to_replace=np.nan, value='없음')
df['requirements'] = df['requirements'].replace(np.nan, '없음')
df['preference'] = df['preference'].replace(np.nan, '없음')
df.head()

# 주요 업무의 값들을 리스트로 만들어줌(한 뭉탱이)
texts = df['responsibilities'].values.tolist()

# 함수 사용. 키워드, 랭크, 그래프를 output으로 뱉어줌
wordrank_extractor = KRWordRank(
	min_count=3, 
    max_length=15, 
    verbose=True)

beta = 0.85
max_iter = 10

keyword, rank, graph = wordrank_extractor.extract(texts, beta, max_iter)

# top 100 출력
stopwords = {'대한','분이면', '있습니다.','분석','데이터', '위한', 'and', '통해', '통한','있는','the','to','in','for','of'}  #걸렀으면 하는 stopwords
passwords = {word:score for word, score in sorted(   
keywords.items(), key=lambda x:-x[1])[:100] if not (word in stopwords)}

# 한글폰트 지원이 되지 않기 때문에 별도로 이걸 깔아줘야한다.
import matplotlib as mpl
import matplotlib.pyplot as plt
 
%config InlineBackend.figure_format = 'retina'
 
!apt -qq -y install fonts-nanum
 
import matplotlib.font_manager as fm
fontpath = '/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf'
font = fm.FontProperties(fname=fontpath, size=9)
plt.rc('font', family='NanumBarunGothic') 
# mpl.font_manager._rebuild()
# [출처] [Google Colab] 구글 코랩 한글 적용 문제 대응, Matplotlib|작성자 넬티아

# 워드 클라우드 그리기
from wordcloud import WordCloud
from wordcloud import ImageColorGenerator

wc = WordCloud(font_path = fontpath, width=1000, height=1000, scale=3.0, max_font_size=250)
gen = wc.generate_from_frequencies(passwords)
plt.figure()
plt.imshow(gen)

📌 저연차는 지표를 얼마나 잘 세우는지가 중요할 것 같다!
📌 코호트, 리텐션, AARRR, 퍼널 분석, LTV 등의 metric

profile
자라나라 새싹새싹🌱

0개의 댓글