Did I find the right examples for you? yes no

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Returns the most common value

        def mode(lst):
    "Returns the most common value"
    # Count each item
    counts = defaultdict(int)
    for x in lst:
        counts[x] += 1

    # Determine the maximum count
    max = 0
    item = None
    for val, count in counts.iteritems():
        if count > max:
            max = count
            item = val

    # Return the most common
    return item
        


src/p/y/pypred-0.3.6/pypred/compare.py   pypred(Download)
    if name[1] == "equality":
        values = [e.right.value for e in exprs]
        filter_using = util.mode(values)
        for e in exprs:
            if e.right.value == filter_using:
            filter_using = util.median(values)
        else:
            filter_using = util.mode(values)
 
        for e in exprs:

src/p/y/pypred-HEAD/pypred/compare.py   pypred(Download)
    if name[1] == "equality":
        values = [e.right.value for e in exprs]
        filter_using = util.mode(values)
        for e in exprs:
            if e.right.value == filter_using:
            filter_using = util.median(values)
        else:
            filter_using = util.mode(values)
 
        for e in exprs: