Related Tags

statistics
method
python
communitycreator

# How to use the statistics median_high() method in Python

Onyejiaku Theophilus Chidalu

### Overview

The statistics.median_high() method is used to return the high median value of a group of data.

The high median value of a group of data is simply the higher middle value of that data.

### Syntax

statistics.median_high(data)

### Parameters

Parameter Description
data This is required. It is the data you are working with. It could be a list, sequence, or iterator.

### Return value

The statistics.median_high() method returns a float value, which represents the high median value of a group of data when arranged in ascending or descending order.

### Example

Now, let’s use the statistics.median_high() method to find the median of grouped continuous data.

#### Code

import statistics

data1 = [1, 2, 3, 4,]
# using the data parameter alone
print('The high median value of the data is:', statistics.median_high(data1))

data2 = [1, 2, 3, 4, 5, 6]
print('The high median value of the data is:', statistics.median_high(data2))

#### Explanation

• Line 1: We imported the statistics module.
• Line 3: We created a Data list we called data1.
• Line 5: We returned the output for the value of the median for the grouped continuous data using the statistics.median_high() method.
• Line 8: We created a Data list we called data2.
• Line 9: We returned the output for the value of the median for the data using the statistics.median_high() method .

RELATED TAGS

statistics
method
python
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu
RELATED COURSES

View all Courses

Keep Exploring

Learn in-demand tech skills in half the time