Mercurial Hosting > traffic-intelligence
changeset 242:942455aff829
merged with the addition of Mohamed's code
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 13 Jul 2012 17:30:25 -0400 |
parents | ee1caff48b03 (diff) d2b68111f87e (current diff) |
children | e0988a8ace0c |
files | |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/python/utils.py Fri Jul 13 17:08:31 2012 -0400 +++ b/python/utils.py Fri Jul 13 17:30:25 2012 -0400 @@ -164,6 +164,14 @@ # maths section ######################### +def sortXY(X,Y): + 'returns the sorted (x, Y(x)) sorted on X' + D = {} + for x, y in zip(X,Y): + D[x]=y + xsorted = sorted(D.keys()) + return xsorted, [D[x] for x in xsorted] + def ceilDecimals(v, nDecimals): '''Rounds the number at the nth decimal eg 1.23 at 0 decimal is 2, at 1 decimal is 1.3'''