MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / median_high

Function median_high

tools/python-3.11.9-amd64/Lib/statistics.py:595–611  ·  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

593
594
595def median_high(data):
596 """Return the high median of data.
597
598 When the number of data points is odd, the middle value is returned.
599 When it is even, the larger of the two middle values is returned.
600
601 >>> median_high([1, 3, 5])
602 3
603 >>> median_high([1, 3, 5, 7])
604 5
605
606 """
607 data = sorted(data)
608 n = len(data)
609 if n == 0:
610 raise StatisticsError("no median for empty data")
611 return data[n // 2]
612
613
614def median_grouped(data, interval=1.0):

Callers

nothing calls this directly

Calls 2

sortedFunction · 0.85
StatisticsErrorClass · 0.85

Tested by

no test coverage detected