python list common statistical metric

Solutions on MaxInterview for python list common statistical metric by the best coders in the world

showing results for - "python list common statistical metric"
Juana
04 Oct 2017
1import numpy as np
2import stats as sts
3scores = [31, 24, 23, 25, 14, 25, 13, 12, 14, 23,
4          32, 34, 43, 41, 21, 23, 26, 26, 34, 42,
5          43, 25, 24, 23, 24, 44, 23, 14, 52,32,
6          42, 44, 35, 28, 17, 21, 32, 42, 12, 34]
7#density
8print('sum:',np.sum(scores))
9print('length:',len(scores))
10print('average:',np.mean(scores))
11print('mean:',np.median(scores))
12print('mode:',sts.mode(scores))
13print('1/4 quantile',sts.quantile(scores,p=0.25))
14print('3/4 quantile',sts.quantile(scores,p=0.75))
15#diversity
16print('max:',np.max(scores))
17print('min:',np.min(scores))
18print('diff:',np.max(scores)-np.min(scores))
19print('quantile_diff',sts.quantile(scores,p=0.75)-sts.quantile(scores,p=0.25))
20print('stdard diviation:',np.std(scores))
21print('variance:',np.var(scores))
22print('diversity:',np.std(scores)/np.mean(scores))
23#skewness
24print('偏度:',sts.skewness(scores))
25
similar questions
queries leading to this page
python list common statistical metric