#/usr/bin/python

def Z_Score(data):
    lenth = len(data)
    total = sum(data)
    ave = float(total)/lenth
    tempsum = sum([pow(data[i] - ave,2) for i in range(lenth)])
    tempsum = pow(float(tempsum)/lenth,0.5)
    for i in range(lenth):
        data[i] = (data[i] - ave)/tempsum
    return data

print Z_Score([2,2,3,4,5,6,7,8])
print Z_Score([10,20,30,40,50,60,70,80])
print Z_Score([20,20,30,40,50,60,70,80])
 
  

  

相关文章:

  • 2021-11-21
  • 2021-08-03
  • 2022-12-23
  • 2021-12-10
  • 2021-07-31
  • 2021-10-17
  • 2021-10-17
猜你喜欢
  • 2021-07-29
  • 2021-11-25
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2021-07-11
  • 2021-11-20
相关资源
相似解决方案