Python |集合2中的统计函数(扩展度量)

Python |集1中的统计函数(中心位置的平均值和度量)

null

本文讨论了统计学的扩散函数测度。

1.差异() :-此函数计算方差,即 测量数据的偏差,方差值越大,数据值就越分散 .假设数据属于总体的一部分,则在此函数中计算样本方差。如果传递的参数为空, 统计误差 她长大了。

2.pvariance() :-此函数用于计算 总体方差 .这些数据被解读为全体人口的数据。如果传递的参数为空, 统计误差 她长大了。

# Python code to demonstrate the working of
# variance() and pvariance()
# importing statistics to handle statistical operations
import statistics
# initializing list
li = [ 1.5 , 2.5 , 2.5 , 3.5 , 3.5 , 3.5 ]
# using variance to calculate variance of data
print ( "The variance of data is : " ,end = "")
print (statistics.variance(li))
# using pvariance to calculate population variance of data
print ( "The population variance of data is : " ,end = "")
print (statistics.pvariance(li))


输出:

The variance of data is : 0.6666666666666667
The population variance of data is : 0.5555555555555556

3.stdev() :-此函数返回 标准偏差(样本方差的平方根) 对数据的分析。如果传递的参数为空, 统计误差 她长大了。

4.pstdev() :-此函数返回人口 标准差(总体方差的平方根) 对数据的分析。如果传递的参数为空, 统计误差 她长大了。

# Python code to demonstrate the working of
# stdev() and pstdev()
# importing statistics to handle statistical operations
import statistics
# initializing list
li = [ 1.5 , 2.5 , 2.5 , 3.5 , 3.5 , 3.5 ]
# using stdev to calculate standard deviation of data
print ( "The standard deviation of data is : " ,end = "")
print (statistics.stdev(li))
# using pstdev to calculate population standard deviation of data
print ( "The population standard deviation of data is : " ,end = "")
print (statistics.pstdev(li))


输出:

The standard deviation of data is : 0.816496580927726
The population standard deviation of data is : 0.7453559924999299

本文由 曼吉星 .如果你喜欢GeekSforgek,并想贡献自己的力量,你也可以使用 贡献极客。组织 或者把你的文章寄到contribute@geeksforgeeks.org.看到你的文章出现在Geeksforgeks主页上,并帮助其他极客。

如果您发现任何不正确的地方,或者您想分享有关上述主题的更多信息,请写下评论。

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享