Answers for "python list common statistical metric"

0

python list common statistical metric

import numpy as np
import stats as sts
scores = [31, 24, 23, 25, 14, 25, 13, 12, 14, 23,
          32, 34, 43, 41, 21, 23, 26, 26, 34, 42,
          43, 25, 24, 23, 24, 44, 23, 14, 52,32,
          42, 44, 35, 28, 17, 21, 32, 42, 12, 34]
#density
print('sum:',np.sum(scores))
print('length:',len(scores))
print('average:',np.mean(scores))
print('mean:',np.median(scores))
print('mode:',sts.mode(scores))
print('1/4 quantile',sts.quantile(scores,p=0.25))
print('3/4 quantile',sts.quantile(scores,p=0.75))
#diversity
print('max:',np.max(scores))
print('min:',np.min(scores))
print('diff:',np.max(scores)-np.min(scores))
print('quantile_diff',sts.quantile(scores,p=0.75)-sts.quantile(scores,p=0.25))
print('stdard diviation:',np.std(scores))
print('variance:',np.var(scores))
print('diversity:',np.std(scores)/np.mean(scores))
#skewness
print('偏度:',sts.skewness(scores))
Posted by: Guest on August-02-2021

Code answers related to "python list common statistical metric"

Python Answers by Framework

Browse Popular Code Answers by Language