MCPcopy Index your code
hub / github.com/python/cpython / median_high

Function median_high

Lib/statistics.py:376–392  ·  view source on GitHub ↗

Return the high median of data. When the number of data points is odd, the middle value is returned. When it is even, the larger of the two middle values is returned. >>> median_high([1, 3, 5]) 3 >>> median_high([1, 3, 5, 7]) 5

(data)

Source from the content-addressed store, hash-verified

374
375
376def median_high(data):
377 """Return the high median of data.
378
379 When the number of data points is odd, the middle value is returned.
380 When it is even, the larger of the two middle values is returned.
381
382 >>> median_high([1, 3, 5])
383 3
384 >>> median_high([1, 3, 5, 7])
385 5
386
387 """
388 data = sorted(data)
389 n = len(data)
390 if n == 0:
391 raise StatisticsError("no median for empty data")
392 return data[n // 2]
393
394
395def median_grouped(data, interval=1.0):

Callers

nothing calls this directly

Calls 1

StatisticsErrorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…