Skip to content

Instantly share code, notes, and snippets.

@RahulKulhari
RahulKulhari / output
Created March 1, 2016 05:59 — forked from def/output
cPickle vs cPickle+HIGHEST_PROTOCOL vs marshal
cPickle default dumps: 0.107237100601
cPickle HIGHEST_PROTOCOL dumps: 0.0678668022156
marshal dumps: 0.0203359127045
cPickle default loads: 0.0411729812622
cPickle HIGHEST_PROTOCOL loads: 0.0352649688721
marshal loads: 0.0221829414368
@RahulKulhari
RahulKulhari / customer-segmentation.py
Last active August 25, 2015 20:38 — forked from glamp/customer-segmentation.py
Analysis for customer segmentation blog post
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()
# coding=UTF-8
from __future__ import division
import nltk
from collections import Counter
# This is a simple tool for adding automatic hashtags into an article title
# Created by Shlomi Babluki
# Sep, 2013
# coding=UTF-8
from __future__ import division
import nltk
from collections import Counter
# This is a simple tool for adding automatic hashtags into an article title
# Created by Shlomi Babluki
# Sep, 2013