Mercurial > hg > nsaunier > traffic-intelligence
comparison python/tests/utils.txt @ 455:abe0b2347d4c
added most common utility function
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 18 Feb 2014 14:52:49 -0500 |
| parents | a7af3519687e |
| children | bce1fe45d1b2 |
comparison
equal
deleted
inserted
replaced
| 454:62d05436099d | 455:abe0b2347d4c |
|---|---|
| 41 >>> values[-1] | 41 >>> values[-1] |
| 42 6.0 | 42 6.0 |
| 43 | 43 |
| 44 >>> stepPlot([3, 5, 7, 8], 1, 10, 0) | 44 >>> stepPlot([3, 5, 7, 8], 1, 10, 0) |
| 45 ([1, 3, 3, 5, 5, 7, 7, 8, 8, 10], [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) | 45 ([1, 3, 3, 5, 5, 7, 7, 8, 8, 10], [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) |
| 46 | |
| 47 >>> mostCommon(['a','b','c','b']) | |
| 48 'b' | |
| 49 >>> mostCommon(['a','b','c','b', 'c']) | |
| 50 'b' | |
| 51 >>> mostCommon(range(10)+[1]) | |
| 52 1 | |
| 53 >>> mostCommon([range(2), range(4), range(2)]) | |
| 54 [0, 1] | |
| 46 | 55 |
| 47 >>> lcss = LCSS(lambda x,y: abs(x-y) <= 0.1) | 56 >>> lcss = LCSS(lambda x,y: abs(x-y) <= 0.1) |
| 48 >>> lcss.compute(range(5), range(5)) | 57 >>> lcss.compute(range(5), range(5)) |
| 49 5 | 58 5 |
| 50 >>> lcss.compute(range(1,5), range(5)) | 59 >>> lcss.compute(range(1,5), range(5)) |
