본문 바로가기
C.W.K.
Stream
Lesson 03 of 06 · published

데이터 Profiling — 검증 전에 데이터 알기

~10 min · profiling, exploration, ydata-profiling

Level 0구경꾼
0 XP0/47 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

Profile 안 한 건 검증도 못 해

Schema 검증은 데이터의 진짜 모양을 알고 있을 때 힘을 내. Profiling — 요약 통계, 분포, 결측 패턴, 상관관계, 이상치를 자동으로 훑는 탐색 분석 — 이 그 앎을 만들어 주는 상류 작업이야. 먼저 profile 하고, 거기서 본 것으로 schema 를 써.

Profiling 의 두 갈래

  • 수동, 빠른 쪽 — df.describe(), df.info(), df.isna().mean(), df['col'].value_counts(dropna=False). 매일 쓰다 보면 손에 배는 것들.
  • 자동 리포트 — ydata-profiling (예전 이름 pandas-profiling) 이 type 탐지, 분포, 상관, 결측 패턴, 경고까지 담긴 인터랙티브 HTML 리포트를 만들어 줘. 그 데이터를 처음 보는 동료한테 건네기 좋아.

Code

일상의 빠른 profile snippet·python
import pandas as pd

def quick_profile(df: pd.DataFrame) -> None:
    print(f'shape: {df.shape}')
    print(f'memory: {df.memory_usage(deep=True).sum() / 1e6:.2f} MB')
    print()
    print('dtypes:')
    print(df.dtypes)
    print()
    print('missingness:')
    print((df.isna().mean().sort_values(ascending=False).head(10) * 100).round(2).to_string())
    print()
    print('cardinality (unique counts):')
    print(df.nunique().sort_values().head(10).to_string())
    print()
    print('numeric describe:')
    print(df.describe(include='number').T.head(10).to_string())

quick_profile(orders_df)
ydata-profiling — 한 번 호출로 전체 HTML 리포트·python
from ydata_profiling import ProfileReport

profile = ProfileReport(orders_df,
                        title='Orders profile (2026-04-30)',
                        minimal=False,           # 큰 DataFrame 엔 True
                        explorative=True)
profile.to_file('reports/orders_profile.html')

External links

Exercise

최소 50,000 row, 10 column 짜리 DataFrame 을 골라. Quick-profile snippet 을 돌리고, 뜻밖이었던 것 세 가지를 메모해. 그다음 ydata-profiling 을 돌려 HTML 리포트를 열어 봐. 둘을 비교해 — quick-profile 은 매일 쓰는 반사경이고, ydata 는 동료와 공유할 때 꺼내는 정밀 검사야.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인 — 댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.