statistics模块的作用
statistics模块实现了很多常用的统计公式,允许使用Python的各种数值类型(int,float,Decimal和Fraction)来完成高效的计算。
1、求一个列表的平均数
from statistics import * data = [1, 2, 2, 5, 10, 12] print('{:0.2f}'.format(mean(data)))
statistics模块的作用
statistics模块实现了很多常用的统计公式,允许使用Python的各种数值类型(int,float,Decimal和Fraction)来完成高效的计算。
1、求一个列表的平均数
from statistics import * data = [1, 2, 2, 5, 10, 12] print('{:0.2f}'.format(mean(data)))
相关文章: