Python statistics.median_low() Function
The Python statistics.median_low() function calculates the low median of the given data set. Before calculating the low median, this function sorts the data in ascending order.
Note: In this function, if the data values are odd, it returns the middle value; otherwise, it returns a smaller value from the two middle numbers.
Syntax
Following is the basic syntax of the statistics.median_low() function −
statistics.median_low(data)
Parameters
Here, the data values can be used as any sequence, list or iterator.
Return Value
This function returns the middle value in the given data.
Example 1
In the below example, we are calculating the low median of the given data using statistics.median_low() function.
import statistics x = statistics.median_low([2, 4, 6, 8, 10]) print(x)
Output
The output obtained is as follows −
6
Example 2
Now, we are calculating the low median for the negative even numbers using statistics.median_low() function.
import statistics x = statistics.median_low([-2, 4, -0.6, 8.3, 10, -11]) print(x)
Output
We will get the output as follows −
-0.6
Example 3
Here, we are calculating the low median for the given data using the statistics.median_low() function.
import statistics x = statistics.median_low([1, 3, 5, 7, 9, 11]) print(x)
Output
The result is obtained as follows −
5
python_modules.htm