Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = [('Cape Town - Durban','RT',95),
- ('Cape Town - Durban','BT',185),
- ('Cape Town - Durban','BE',285),
- ('Cape Town - Durban','RT',100),
- ('Cape Town - Durban','BT',190),
- ('Cape Town - Durban','BE',290),]
- delay={}
- for path,cos,ms in data:
- if not delay.has_key(cos):
- delay[cos] = {path: {ms:1}}
- elif not delay[cos].has_key(path):
- delay[cos][path] = {ms:1}
- elif not delay[cos][path].has_key(ms):
- delay[cos][path][ms] = 1
- else:
- delay[cos][path][ms]+= 1
- for cos in delay.keys():
- for path,values in delay[cos].items():
- histogram=[]
- for i in range(90,300):
- count = delay[cos][path].setdefault(i, 0)
- histogram.append(str(count))
- print '%s: %s: %s' % (cos,path,' '.join(histogram))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement