Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
statistics
median
communitycreator

How to use the statistics.median_low() method in Python

Onyejiaku Theophilus Chidalu

Overview

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

The low median value of a group of data is simply the lowest middle value of that data when arranged in ascending or descending order.

Syntax

statistics.median_low (data)  
Parameter value

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_low() method returns a float value which represents the low median value of a group of data.

Example

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

Code

import statistics

data1 = [1, 2, 3, 4,]
# using the data parameter alone
print('The low median value of the data is:', statistics.median_low(data1))
data2 = [1, 2, 3, 4, 5, 6]
print('The low median of the data is:', statistics.median_low(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 data using the statistics.median_low() method.
  • Line 6: We created a Data list we called data2.
  • Line 7: We returned the low median for data using the statistics.median_low() method.

RELATED TAGS

python
statistics
median
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu
RELATED COURSES

View all Courses

Keep Exploring