Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python statistics.median_low() Method

Python statistics.median_low() Method

Python statistics Module Python statistics Module

Python statistics.median_low() Used to compute the low median of a given data set.

Syntax

The syntax of the statistics.median_low() method is as follows:



statistics.median_low(data)

Parameter Description:

Return Value

The function computes and returns the low median of the data set as the result.

Example

The following example demonstrates the median_low() function:

Example

import

statistics

data

=

[

1

,

3

,

5

,

7

,

9

]

median

=

statistics.

median_low

(

data

)

print

(

median

)

Output result:



5

In the above example, the given data set is [1, 3, 5, 7, 9], and the median_low() method computes a low median of 5.

The low median is a method of computing the median of a data set that selects the middle value or the smaller of the two after sorting. When the number of elements is odd, the low median is the same as the ordinary median; when it is even, the low median selects the smaller value.

The median_low() method may be more suitable in certain cases, especially when you want to select the smaller value as the median. If you want to select the larger value as the median, you can use median_high() method.

Python statistics Module Python statistics Module