Created
April 20, 2014 19:19
-
-
Save thinrhino/11122670 to your computer and use it in GitHub Desktop.
Kaggle: Acquire Valued Shoppers Challenge: reducing the dataset from 22GB to 1GB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas | |
df = pandas.read_csv('offers.csv.gz', compression='gzip') | |
categories = df.category.tolist() | |
subset = open('subset.csv', 'w') | |
fl = open('transactions.csv', 'r') | |
fl.readline() | |
while True: | |
l = fl.readline() | |
if l == '': | |
break | |
if numpy.int64(l.split(',')[3]) in categories: | |
subset.write(l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment