Did I find the right examples for you? yes no

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

        def median(lst):
    "Returns the median value"
    # Sort
    lst.sort()

    # Get the middle index
    middle = len(lst) / 2
    return lst[middle]
        


src/c/m/cmonkey-python-HEAD/cmonkey/scoring.py   cmonkey-python(Download)
            scale = util.r_stddev(rsm)
        if scale != 0:
            median_rsm = util.median(rsm)
            rsvalues = (mat.values - median_rsm) / scale
            num_rows, num_cols = rsvalues.shape

src/p/y/pypred-0.3.6/pypred/compare.py   pypred(Download)
        # For non-numeric, we use mode
        if is_static:
            filter_using = util.median(values)
        else:
            filter_using = util.mode(values)

src/p/y/pypred-HEAD/pypred/compare.py   pypred(Download)
        # For non-numeric, we use mode
        if is_static:
            filter_using = util.median(values)
        else:
            filter_using = util.mode(values)

src/c/m/cmonkey-python-HEAD/test/util_test.py   cmonkey-python(Download)
    def test_median_with_nans(self):
        """tests the mean() function"""
        array = np.array([2.0, 3.0, np.nan, 1.0])
        result = util.median(array)
        self.assertAlmostEqual(2.0, result)