Median - maximiliamus/weby-sloth GitHub Wiki

Calculates the median which is the numerical value separating the higher half of the values of a column, from the lower half.

$sloth = Sloth::from($data)
    ->group('foo', 'baz')
    ->median();
$sloth->print();
foo     baz
one     2
two     5.5
print_r($sloth->fetch());
Array
(
    [0] => Array
    (
        [foo] => one
        [baz] => 2
    )
    [1] => Array
    (
        [foo] => two
        [baz] => 5.5
    )
)
⚠️ **GitHub.com Fallback** ⚠️