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)
| 374 | |
| 375 | |
| 376 | def 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 | |
| 395 | def median_grouped(data, interval=1.0): |
nothing calls this directly
no test coverage detected
searching dependent graphs…