Skip to content

Instantly share code, notes, and snippets.

Avatar

Gustavo De Mari Pereira gustavodemari

View GitHub Profile
@glamp
glamp / customer-segmentation.py
Last active Apr 30, 2020
Analysis for customer segmentation blog post
View customer-segmentation.py
import pandas as pd
# http://blog.yhathq.com/static/misc/data/WineKMC.xlsx
df_offers = pd.read_excel("./WineKMC.xlsx", sheetname=0)
df_offers.columns = ["offer_id", "campaign", "varietal", "min_qty", "discount", "origin", "past_peak"]
df_offers.head()
df_transactions = pd.read_excel("./WineKMC.xlsx", sheetname=1)
df_transactions.columns = ["customer_name", "offer_id"]
df_transactions['n'] = 1
df_transactions.head()