我在python中有一个整数数组,我成功地使用importstatistics
从数据集中计算了mean
和standard deviation
。我不太明白这句话的意思。代码要求我打印播放器数组中所有偏离平均值一次的元素。这就是我试过的。我理解与平均值mean-deviation
和mean +deviation
的偏差。所以我尝试打印该范围内的所有值,但仍然出错。偏离平均值是什么?我做错了什么
players = [180, 172, 178, 185, 190, 195, 192, 200, 210, 190]#this is the data set
mymean=statistics.mean(players)#got the mean
mydeviation=statistics.stdev(players)#got the standard deviation
for i in range(int(mymean-mydeviation),int(mymean+mydeviation)+1):#I think this is what one standard deviation from the mean means otherwise what am i doing wrong?
for k in players:
if(k==i):#filter values from players that match the criteria
print (k)
相关问题 更多 >
编程相关推荐