<aside> 📌 실행 및 진행 사항 정리
</aside>

각 등급별 이상치 제외 시 고객 수 50명씩 줄어듬

n_top = 3 # 상위 N명
top_n_each = (
df.sort_values(['Blue_Segment', 'New_CLV'], ascending=[True, False])
.groupby('Blue_Segment')
.head(n_top)
.reset_index(drop=True)
)
# 각 고객별 조합 문자열 생성
top_n_each['조합'] = (
"제품은 '" + top_n_each['Product Type'].astype(str) + "', "
+ "결제는 '" + top_n_each['Payment Method'].astype(str) + "', "
+ "배송은 '" + top_n_each['Shipping Type'].astype(str) + "'"
)
# 결과 출력
for segment in ['BLUE DIAMOND', 'BLUE SAPPHIRE', 'BLUE MARINE', 'BLUE OCEAN', 'BLUE SKY']:
print(f"\\n:큰_파란색_네모: [세그먼트: {segment}] CLV 상위 3명 조합")
display(
top_n_each[top_n_each['Blue_Segment'] == segment][
['Customer ID', 'New_CLV', '조합']
]
)
<aside> 📌 Task :
</aside>