-
728x90
.value_counts() = unique() #항목명 + nunique() #항목개수
ex) df['color'].unique() # array['red','blue','green'], df['color'].nunique() # 3, df[].value_counts() # red 1 blue 1 green 1
df.select_dtypes('object').apply(pd.Series.nunique, axis=0) # 더미화 대상찾기 (2면 labelencoder 2이상 onehotencoder)
app_train, app_test = app_train.align(app_test, join = 'inner', axis = 1) # 더미화 후 train엔 있지만 test엔 없는 변수제거(app_train['DAYS_BIRTH'] / -365).describe() # 이상치, (나이-대출신청날짜) ex) 1995-06-06 - 2022-02-15
age_data['YEARS_BINNED'] = pd.cut(age_data['YEARS_BIRTH'], bins = np.linspace(20, 70, num = 11)) #변수 추가 # 나이의 범위
age_data.head(10)728x90