statistics.median_low

Full name
statistics.median_low
Library
statistics
Syntax

statistics.median_low(data)

Description

The statistics.median_low function returns the median of the elements in data. For its calculation, the ordered elements are considered: If the number of elements is odd, the function returns the value that occupies the central position. If the number of elements is even, the lowest of the two closest to the center position is returned.

Parameters
  • data: Sequence or iterable from whose elements you want to calculate the median.
Result

The statistics.median_low function returns an integer or real number.

Examples

We can obtain the median of the numbers contained in a list with the following code:

statistics.median_low([1, 3, 6, 11, 11])
6

In this case, the number of elements is odd, so the function returns the value that occupies the central position if we consider them ordered (in the example the values are already ordered to make its interpretation easier).

If the number of elements is even, the lowest value of the two closest to the central position is returned (the values 3 and 4 in the following example):

statistics.median_low([1, 3, 4, 11])
3
Submitted by admin on Sat, 03/27/2021 - 08:45