def anayAct(): f = open(tempDataDir,"wb") for i in range(10000,900000,10000): con = Condition("userid between "+str(i)+" and "+str(i+10000)) actdenseList = dictToOrderList(con.actDense) datedenseList = dictToOrderList(con.dateDense) f.write(str(i)+","+str(actdenseList[0])+ "," + str(datedenseList[0]) +"\n")
def calActSummary(sql): res = dbconn.query(sql) summary = {} for r in res: actSummaryString = r.actSummaryString actStrings = actSummaryString[1:].split(u"$") for actString in actStrings: act,count = actString.split(u"|")[0], actString.split(u"|")[1] if summary.has_key(act): summary[act] = summary[act] + 1 else: summary.update({act:1}) summaryOrder = dictToOrderList(summary) return summaryOrder
def ana(condition): cons = [ condition, condition + " and sumcount = 1", condition + " and sumcount = 2", condition + " and sumcount between 3 and 10", condition + " and sumcount > 10" ] f = open(tempDataDir,"wb") for c in cons: con = Condition(c) flist = dictToOrderList(con.firstact) ##mlist = dictToOrderList(con.mostact) f.write(c+"\n") for v in flist: f.write(str(v[0])+","+str(v[1])+"\n")