<aside> 📌 Task :

</aside>

대전제 조건

# 2) 완료 주문만 필터(필요 시)
SSE = SSE[SSE['Order Status'] == 'Completed']

# 3) 주문 월(order_month) 생성
SSE['order_month'] = SSE['Purchase Date'].dt.to_period('M')

# 4) 제품별 월별 구매 건수 집계
monthly_sales = (
    SSE
    .groupby(['order_month', 'Product Type'])
    .size()
    .reset_index(name='sales_count')
)

# 5) pivot: 각 제품을 컬럼으로 펼치기
pivot_SSE = monthly_sales.pivot(
    index='order_month',
    columns='Product Type',
    values='sales_count'
).fillna(0)

# 6) x축에 매월 표시할 datetime 인덱스
x = pivot_SSE.index.to_timestamp()

# 7) 라인 차트 그리기
plt.figure(figsize=(12, 6))
for product in pivot_SSE.columns:
    plt.plot(x, pivot_SSE[product], marker='o', label=product)

# 8) xticks를 모든 월로 설정
plt.xticks(x, [d.strftime('%Y-%m') for d in x], rotation=45)

plt.title('Monthly Purchase Volume by Product Type')
plt.xlabel('Month')
plt.ylabel('Number of Purchases')
plt.legend(title='Product Type', loc='upper left', bbox_to_anchor=(1, 1))
plt.tight_layout()
plt.show()

스크린샷 2025-07-11 오전 10.15.30.png

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

</aside>

기준 정리

CLV : TOTAL PURCHASED AMOUT 컬럼

이탈기준 : 90일 이상 재구매가 없는 사용자


대립가설 목록

1. 고객 세그먼트별 구매 행동 분석 및 맞춤형 마케팅 전략 제안

2. 제품별 판매 성과 분석 및 재고/제품 라인업 최적화 전략