주제 변경
오늘은 선거일이고 공휴일이지만 우리팀은 모였따... ㅋ
왜냐면 주제를 변경해야하기 때문! 기존 베스티에르 데이터는 군집을 하기도 애매하고 가격예측을 하기도 애매하고 인사이트를 내기도 애매하다는 튜터님의 의견이 있었다.
그래서 생각한 건 올리스트 데이터
Brazilian E-Commerce Public Dataset by Olist
Brazilian E-Commerce Public Dataset by Olist
100,000 Orders with product, customer and reviews info
www.kaggle.com
요약하자면, 올리스트의 수익구조는 다음과 같다.
소상공인을 올리스트가 아마존과 같은 사이트에 판매를 하도록 도와주고 판매 수수료를 받는 것!
판매과정을 대신 해주는 거에 대한 멤버십 비용도 받는다.
따라서 올리스트의 고객은 구매자가 아닌 판매자이다.
그래서 구매자는 그룹화, 판매자는 클러스터링을 진행하여 구매자 별로 자신의 고객이 어떤 유형인지 볼 수 있도록 만들 예정이다.
데이터 전처리
import pandas as pd
# CSV 파일 로드
orders = pd.read_csv('olist_orders_dataset.csv')
customers = pd.read_csv('olist_customers_dataset.csv')
order_items = pd.read_csv('olist_order_items_dataset.csv')
products = pd.read_csv('olist_products_dataset.csv')
sellers = pd.read_csv('olist_sellers_dataset.csv')
order_reviews = pd.read_csv('olist_order_reviews_dataset.csv')
geolocation = pd.read_csv('olist_geolocation_dataset.csv')
category_translation = pd.read_csv('product_category_name_translation.csv')
order_payments = pd.read_csv('olist_order_payments_dataset.csv')
# 상품 + 카테고리명 번역 join (상품 기준)
products = products.merge(category_translation, on='product_category_name', how='left')
# 주문 + 고객 정보
orders_customers = orders.merge(customers, on='customer_id', how='inner')
# 주문 + 아이템
orders_customers_items = orders_customers.merge(order_items, on='order_id', how='inner')
# 아이템 + 상품 상세
orders_customers_items_products = orders_customers_items.merge(products, on='product_id', how='left')
# + 판매자 정보
orders_full = orders_customers_items_products.merge(sellers, on='seller_id', how='inner')
# + 결제 정보
orders_full = orders_full.merge(payments_summary, on='order_id', how='left')
# + 리뷰 정보
orders_full = orders_full.merge(reviews_summary, on='order_id', how='left')
# + 고객 위치
df = orders_full.merge(
geolocation.drop_duplicates('geolocation_zip_code_prefix'),
left_on='customer_zip_code_prefix',
right_on='geolocation_zip_code_prefix',
how='left',
suffixes=('', '_geo')
)
#컬럼 두 개 생긴 거 제거
df = df.drop(columns=['geolocation_zip_code_prefix'])
print(df.head())
처음에 모든 테이블 다 inner_join했다가 데이터가 100만건이 넘어서 뭐지? 했더니
위치 테이블에 있는 컬럼이 중복된게 많아서였다. 그래서 중복 제거한 다음 join했더니 잘 됐다.
'데이터분석 6기 > 본캠프' 카테고리의 다른 글
2025-06-04 최종 프로젝트 셀러 분석 (0) | 2025.06.04 |
---|---|
2025-06-04 최종 프로젝트 데이터 전처리 (1) | 2025.06.04 |
2025-05-30 경쟁사 분석/고이비토 (0) | 2025.05.30 |
2025-05-30 최종프로젝트(베스티에르) 데이터 전처리 (0) | 2025.05.30 |
2025-05-29 최종 프로젝트 데이터 살펴보기 (0) | 2025.05.29 |