def getNextCustID(): orders = fileOps.openCsvDebug("casesDebug.csv") temp = 0 for key, prods in orders.iteritems(): if int(key[1:]) > temp: temp = int(key[1:]) temp = temp + 1 temp = 'c' + str(temp) return temp
import fileOps, math from Tkinter import * from simMetrics import * from collections import defaultdict products = fileOps.openCsv("products.csv") orders = fileOps.openCsvDebug("casesDebug.csv") orderDebug = fileOps.openCsvDebug("casesDebug.csv") newOrderDict = {} customerProducts = [] orderSimilarity = {} similarityThreshold = 0.3 #similarityThreshold = raw_input('Enter threshold:') state = 1 #Iterate over the CSV. def main(): forgetFrames() global newOrderDict newOrderDict = {} customerProducts = [] orderSimilarity = {} custID = custEntry.get() custType = fileOps.getStockistType("c" + custID) print custType print '++=========++' for key, prods in orders.iteritems(): if "c" + custID == key: #Once we've find the customer, we've got our list of products and can break the loop. customerProducts += prods
import fileOps, math from simMetrics import * from collections import defaultdict products = fileOps.openCsv("products.csv") orders = fileOps.openCsvDebug("cases.csv") orderDebug = fileOps.openCsvDebug("casesDebug.csv") newOrderDict = {} customerProducts = [] orderSimilarity = {} # similarityThreshold = raw_input('Enter threshold:') similarityThreshold = 0.3 custID = raw_input("Enter customer ID:") # Iterate over the CSV. for key, prods in orders.iteritems(): if "c" + custID == key: # Once we've find the customer, we've got our list of products and can break the loop. customerProducts = prods print customerProducts print "----------" for key, prods in orders.iteritems(): if custID != key: customerProducts = set(customerProducts) prods = set(prods)