탐색적 데이터 분석

Python으로 Machine Learning을 활용한 CTR 예측

Kevin Huo

Instructor

특성 자세히 보기

print(df.columns)
['id', 'click', 'hour', 'C1', ... ]
print(df.dtypes)
id                  object
click                int64
...
  • int: 정수: 1, 2
  • float: 실수: 3.02, 4.56
  • object: 문자열: "hello", "world"
  • datetime: 날짜/시간: 2018-01-01
df.select_dtypes(
  include=['int', 'float'])
click                int64
...
Python으로 Machine Learning을 활용한 CTR 예측

결측치 확인

df.info()
Data columns (total 24 columns):
id            50000 non-null object
df['id'].isnull()
[False, False, False, False, ... ]
df.isnull().sum(axis = 0)
dtype: object
id                  0
...
df.isnull().sum(axis = 0).sum()
0
Python으로 Machine Learning을 활용한 CTR 예측

분포 살펴보기

df.groupby(['search_engine_type', 
            'click']).size()
search_engine_type    click
1002          0          940
              1          240
                   ...
df.groupby(['search_engine_type',
            'click']).size().unstack()
click                  0     1
search_engine_type               
1002                 940   240
               ...
Python으로 Machine Learning을 활용한 CTR 예측

CTR 기준 분해

df.reset_index()
click  search_engine_type      0     1
                     1002    940   240
df = df.rename(columns = {0: 'non_clicks'})
click  search_engine_type  non_clicks  clicks
                     1002         940     240
Python으로 Machine Learning을 활용한 CTR 예측

연습해 봅시다!

Python으로 Machine Learning을 활용한 CTR 예측

Preparing Video For Download...