The Python statistics.median_high() function calculates the high median of the given data set. Before calculating the high median this functions sorts the data in the ascending order.
Note: In this function if the data values are odd then it returns middle value, otherwise; it returns large value from the two middle numbers.
SyntaxFollowing is the basic syntax of the statistics.median_high() function −
statistics.median_high(data)Parameters
Here, the data values can be used as any sequence, list or iterator.
Return ValueThis function returns the middle value in the given data.
Example 1In the below example we are calculating the high median of the given data using statistics.median_high() function.
import statistics x = statistics.median_high([1, 3, 5, 7, 9, 11]) print(x)Output
The output obtained is as follows −
7Example 2
Here, we are calculating the high median fro the negative float values using statistics.median_high() function.
import statistics x = statistics.median_high([0.1, -3.3, 5, -3.7, -9, 11]) print(x)Output
The result is produced as follows −
0.1Example 3
Now we are calculating high median for the even data set using statistics.median_high() function.
import statistics x = statistics.median_high([2, 4, 6, 8, 10]) print(x)Output
This produces the following −
6
python_modules.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4