Created
May 27, 2014 19:41
-
-
Save jwtea/f17ecbf64aa1f307a34c to your computer and use it in GitHub Desktop.
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
data = {} | |
with open("C:/Python27/pythoncbr/data/"+filename,"rb") as f: | |
reader = csv.DictReader(f) | |
for row in reader: | |
if row['Customer ID'] != "": | |
key = row['Customer ID'] | |
data.setdefault(key, []) | |
data[key].append(row['prodID']) | |
if row['Customer ID'] == "": | |
data[key].append(row['prodID']) | |
return data | |
Data in excel is like this | |
Cust id, prod id, amount, stockist type | |
c1 p1 100 large | |
p2 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment