ํ๋ค์ค ํ๋กํ์ผ๋ง(Pandas Profiling)
์ข์ ๋จธ์ ๋ฌ๋ ๊ฒฐ๊ณผ๋ฅผ ์ป๊ธฐ ์ํด์ ๋ฐ์ดํฐ์ ์ฑ๊ฒฉ์ ํ์ ํ๋ ๊ณผ์ ์ด ์ ํ๋์ด์ผ ํ๋ค. ์ด ๊ณผ์ ์์ ๋ฐ์ดํฐ ๋ด ๊ฐ์ ๋ถํฌ, ๋ณ์ ๊ฐ์ ๊ด๊ณ, Null๊ฐ๊ณผ ๊ฐ์ ๊ฒฐ์ธก๊ฐ(missing values)์กด์ฌ ์ ๋ฌด ๋ฑ์ ํ์ ํ๊ฒ ๋๋๋ฐ ์ด์ ๊ฐ์ด ๋ฐ์ดํฐ๋ฅผ ํ์ ํ๋ ๊ณผ์ ์ EDA(Exploratory Data Analysis, ํ์์ ๋ฐ์ดํฐ ๋ถ์) ์ด๋ผ๊ณ ํ๋ค. ์ด๋ฌํ ํ์์ ๋ฐ์ดํฐ ๋ถ์์ ๋๋ ์๊ฐ์ ์ ์ฝํ๊ธฐ ์ํด ๋ช ์ค์ ์ฝ๋๋ก ์ฌ๋ฌ ๋ถ์ ํต๊ณ๋์ ํ์ธํ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ ํ๋ ๋ฐ ์ด๋ฅผ ํ๋ค์ค ํ๋กํ์ผ๋ง(Pandas-Profiling) ์ด๋ผ๊ณ ํ๋ค.
- pip ๋ช ๋ น์ ํตํด ํจํค์ง ์ค์น
pip install -U pandas-profiling
- ๋ฐ์ดํฐ ๋ก๋ํ๊ธฐ
import numpy as np
import pandas as pd
from pandas_profiling import ProfileReport
import seaborn as sns
df = sns.load_dataset('iris')
df.head()
- ํ๋กํ์ผ ๋ฆฌํฌํธ ์์ฑํ๊ธฐ
profile = df.profile_report() # ํ๋กํ์ผ๋ง ๊ฒฐ๊ณผ ๋ฆฌํฌํธ๋ฅผ profile์ ์ ์ฅ
profile # ๋ฆฌํฌํธ ํ์ธ
# ํ๋กํ์ผ ๋ฆฌํฌํธ๋ฅผ html ํ์์ผ๋ก ์ ์ฅ
profile.to_file('./pr_report.html')
Overview ๋ถํฐ ํด์ Variables, Interactions, Correlations, Missing values, Sample ๋ฑ์ ์ดํด๋ณผ ์ ์๋ค.]
- ๋ฆฌํฌํธ ์ดํด๋ณด๊ธฐ
๋๊ธ