Grokking Modern System Design Interview for Engineers & Managers
Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.
Python’s statistics.median_grouped()
method computes the median of grouped continuous data.
Mathematically, the formula used to calculate the median of grouped continuous data is:
$\large \mathbf{Median = L \ + \frac{(n/2) - B}{G} \ \times W}$
In this formula:
L represents the lower limit of the group containing the median.
n represents the total number of values.
B represents the cumulative frequency of the group before the median group.
G represents the frequency of the median group.
W represents the width of the group.
statistics.median_grouped(data, interval)
Parameter | Description |
| This is a required argument. It contains the data values. |
| This is an optional argument. It represents the class interval. The default value is 1. |
Let’s look at how we can use the statistics.median_grouped()
method to calculate the mean value for grouped continuous data:
import statistics data1 = [1, 2, 3, 4, 5] print(statistics.median_grouped(data1)) # using a step size of 2 print(statistics.median_grouped(data1, 2))
data1
.statistics.median_grouped()
method to get the median value of the grouped data in data1
.statistics.median_grouped()
method to get the median value of the grouped data, using an interval value of 2.RELATED TAGS
CONTRIBUTOR
Grokking Modern System Design Interview for Engineers & Managers
Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.