什么包在Python中具有统计均值功能

问题描述 投票:0回答:1

哪个包在Python中具有“统计平均值”功能。我导入scipy和numpy,但收到错误*“ mean”在scipy中不存在*

mean
1个回答
0
投票

scipynumpy都具有均值函数。假设您已经在计算机和numpy环境中正确安装了scipyPython,则可以这样称呼它:

import numpy
import scipy

items = [ 1, 2, 3, 4, 5 ]

numpy_answer = numpy.mean( items )
scipy_answer = scipy.mean( items )

print( numpy_answer )
print( scipy_answer )
© www.soinside.com 2019 - 2024. All rights reserved.