<aside> ✅ 팀원별
</aside>
Payment Method : Paypal or PayPal 통일 필요 ⇒
→ Payment Method: Method used for payment (e.g., Cash, Credit Card, Paypal)
<aside> 💡 전처리 방법
</aside>
결측치
Gender : drop
Add-ons Purchased : None
Payment Method : Paypal
df['Payment Method'] = df['Payment Method'].replace('PayPal','Paypal')
파생변수 컬럼 생성
age_group : 10대 / 20대 / 30대 / 40대 / 50대 / 60대 / 70대 이상
#나이 그룹 파생 변수
bins_age = [0, 10, 20, 30, 40, 50, 60, 70, 80, np.inf]
labels_age = ['low 10s', '10s', '20s', '30s', '40s', '50s', '60s', '70s', '80s +']
df['age_group'] = pd.cut(df['Age'].astype(float), bins=bins_age, labels=labels_age, right=False)
#최저 최하 이상치 있는지 확인
lowest_Age = df['Age'].min()
highest_Age = df['Age'].max()
print(f"연소자: {lowest_Age}세,{(df['Age']==lowest_Age).sum()}명")
print(f"연장자: {highest_Age}세,{(df['Age']==highest_Age).sum()}명")
#연소자: 18세,301명
#연장자: 80세,289명 이상 없음.
Total : Total Price + Add-on Total
df['Total'] = df['Total Price'] + df['Add-on Total']
Price_group : 4분위수 (Q1,Q2,Q3,Q4)
# 1분위~4분위
labels = ['Q1', 'Q2', 'Q3', 'Q4']
# Total 값을 기준으로 4분위로 나눔
df['Total_group'] = pd.qcut(df['Total'], q=4, labels=labels) #qcut=분위 따라서 나누는 함수
df['Total_group'].value_counts() #확인 결과 각 5000으로 잘 나뉘어짐
Retention : True(재구매) / F(신규 고객) <탐색적 데이터 분석 추가 필요, 인터벌도 확인>
repeat_customers = df[df['Order Status'] == 'Completed']['Customer ID'].value_counts()
repeat_customers = repeat_customers[repeat_customers >= 2].index
#구매 횟수별 사용자 특성 비교 필요/한 번 구매 후 취소한 사람 같은 것
df['Retention'] = df['Customer ID'].isin(repeat_customers)
데이터 수정 사항
Data = Data[Data['Unit Price'].map(Data['Unit Price'].value_counts()) > 1]