filtered.csv
로 저장..isnull().sum()
을 통해 결측치가 있는 컬럼과 개수 확인:
결측치가 존재하는 컬럼 (총 11개)
review_scores_
시리즈와 host_is_superhost
, bathrooms
, beds
, bedrooms
등에 결측치 집중.dropna()
로 삭제하여 분석 정확도를 확보함.outlier_summary
에 저장.
[그림 2] IQR 기반 이상치 탐지 결과 (일부 발췌)
예시:
minimum_nights
: 이상치 6,170개 (상/하한 = 30.0)bathrooms
: 이상치 4,866개 (상한 = 4.0)calculated_host_listings_count
: 이상치 4,077개 (상한 = 46.4)boxplot
과 hist()
를 활용하여 이상치 분포 시각화.변수 | 제거 기준 |
---|---|
minimum_nights | 200 이상 제거 |
bathrooms | 5 이상 제거 |
accommodates | 17 이상 제거 |
beds | 13 이상 제거 |
bedrooms | 10 이상 제거 |
number_of_reviews | 600 이상 제거 |
review_scores_rating | 0~5 범위 이외 제거 |
calculated_host_listings_count | 7 이상 제거 |
price
컬럼에서 달러 기호($
) 및 쉼표(,
) 제거 후 실수 → 정수형으로 변환 완료.df['price'] = df['price'].replace('[\$,]', '', regex=True).astype(float).astype(int)
estimated_occupancy_l365d
컬럼은 0~1 범위로 정규화하여 스케일 통일.컬럼 | 인코딩 방식 |
---|---|
host_is_superhost | One-Hot Encoding (drop_first=True ) |
neighbourhood_group_cleansed | Label Encoding |
property_type | Label Encoding |
LabelEncoder
객체는 추후 복호화를 위해 딕셔너리 형태로 저장.dropna()
보다, 제거 기준이 되는 컬럼을 명확히 하는 것이 중요.