Exemple #1
0
def bucket(data, breakpoints):
    length = len(breakpoints)
    # prevent modifying global variable: breakpoints
    newbreakpoints = [x for x in breakpoints]
    assert(length != 0)
    newbreakpoints[length - 1] += 1
    newbreakpoints[0] -= 1
    return [od.lisearch(newbreakpoints, x, "floor") for x in data]
Exemple #2
0
def findInterval(item, lst):
    return od.lisearch(lst, item, "ceil")