Reference · Statistics
stats.median_low
signature
stats.median_low(list) -> numWhat it does
The low median of a list of numbers: always one of the data points. With an odd count it is the middle value; with an even count it is the lower of the two middle values, where stats.median would average them. An int list gives an int.
Examples
print(stats.median_low([1, 2, 3, 4]), stats.median_low([1, 3, 2]))print(stats.median_low([1, 2, 4, 4]))output
2 22Edge cases
- One number gives that number.
- The answer is a float only when the list holds a float.
- A list need not be sorted.
print(stats.median_low([7]), stats.median_low([1.0, 2, 3, 4]), stats.median_low([10, 2, 8, 4]))output
7 2.0 4Errors
No data is a runtime error, not an error value: an empty list or null stops the
request. So does an item that is not a number.
this one fails
print(stats.median_low([]))output
line 1: `stats.median_low` requires at least one data pointChaining
let sizes = [8, 2, 4, 6]print(sizes | stats.median_low, sizes | stats.median_high, sizes | stats.median)output
4 6 5.0See also
stats.median, stats.median_high, stats.percentile
Thread
Thread 0 posts
On stats.median_low(): questions, tips, corrections, and code that uses it.
No posts yet. The first one opens the thread.
Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo