- class arraymedian(data, ci=95, sf=3, doprint=False, **kwargs)#
Quickly calculate the median and confidence interval of an array.
The confidence interval defaults to 95%. If an integer is supplied, this is treated as a percentile (e.g. 95=95% CI). If a float is supplied, it’s treated as a quantile (e.g. 0.95=95% CI). If a pair of ints or floats is provided, these are treated as upper and lower percentiles/quantiles. If ‘iqr’ is provided, then print the interquartile range (equivalent to 50% CI). If ‘range’ is provided then print the full range (equivalent to 100% CI).
data = [1210, 1072, 1722, 1229, 1902] sc.printmedian(data, 80) # Returns '1230 (80.0% CI: 1130, 1830)'
New in version 3.0.0.