<aside> 📌 Task : 가설 설정하고 검증하기
</aside>
가설 설정 : 일단 세 가지 가설 요렇게 세웠구요
<aside> 📌 실행 및 진행 사항 정리
</aside>
# 비교할 컬럼
compare_cols = ['price', 'minimum_nights', 'availability_365',
'reviews_per_month', 'estimated_revenue_per_month', 'daily_guests']
# 도심/외곽
city_groups = []
for region in df_filtered['city_and_suburb'].dropna().unique():
group = df_filtered[df_filtered['city_and_suburb'] == region]
top = group[group['popularity_score'] >= group['popularity_score'].quantile(0.75)]
bottom = group[group['popularity_score'] <= group['popularity_score'].quantile(0.25)]
top_means = top[compare_cols].mean().rename(f"{region}_상위 25%")
bottom_means = bottom[compare_cols].mean().rename(f"{region}_하위 25%")
city_groups.append(pd.concat([top_means, bottom_means], axis=1))
city_comparison = pd.concat(city_groups, axis=1)
city_comparison.round(1)
# 룸타입
room_groups = []
for room in df_filtered['room_type'].dropna().unique():
group = df_filtered[df_filtered['room_type'] == room]
top = group[group['popularity_score'] >= group['popularity_score'].quantile(0.75)]
bottom = group[group['popularity_score'] <= group['popularity_score'].quantile(0.25)]
top_means = top[compare_cols].mean().rename(f"{room}_상위 25%")
bottom_means = bottom[compare_cols].mean().rename(f"{room}_하위 25%")
room_groups.append(pd.concat([top_means, bottom_means], axis=1))
room_comparison = pd.concat(room_groups, axis=1)
room_comparison.round(1)
<aside> 📌 결과
</aside>
| 컬럼 평균 | 외곽_상위 25% | 외곽_하위 25% | 도심_상위 25% | 도심_하위 25% |
|---|---|---|---|---|
| price | 119.4 | 109.1 | 197.2 | 164.873426 |
| minimum_nights | 3.2 | 5.4 | 4.0 | 6.6 |
| availability_365 | 161.1 | 55.8 | 145.1 | 40.5 |
| reviews_per_month | 3.8 | 0.1 | 3.4 | 0.1 |
| estimated_revenue_per_month | 11272.8 | 947.7 | 20466.6 | 2271.6 |
| daily_guests | 0.9 | 0.001812 | 0.8 | 0.000840 |
| 컬럼 평균 | Private room_ 상위 25% | Private room_ 하위 25% | Entire home/apt_ 상위 25% | Entire home/apt_ 하위 25% | Shared room_ 상위 25% | Shared room_ 하위 25% | | --- | --- | --- | --- | --- | --- | --- | | price | 88.3 | 89.6 | 203.9 | 186.9 | 64.6 | 92.3 | | minimum_nights | 3.3 | 4.6 | 3.7 | 7.2 | 1.9 | 6.5 | | availability_365 | 146.1 | 47.9 | 160.2 | 41.7 | 163.6 | 124.2 | | reviews_per_month | 3.8 | 0.1 | 3.5 | 0.1 | 3.6 | 0.2 | | estimated_revenue_per_month | 7395.9 | 1242.9 | 22091.0 | 2004.0 | 3184.6 | 489.0 | | daily_guests | 0.9 | 0.002262 | 0.9 | 0.000785 | 0.9 | 0.0 |