scipy stats 几何平均值返回 NaN
我使用 scipy 的 gmean() 函数来确定包含电压输出的 numpy 数组的几何平均值。数字的范围在 -80.0 和 30.0 之间。目前,numpy 数组是二维的,给出了两种不同测量的电压。
array([[-60.0924, -60.0882],
[-80. , -80. ],
[-80. , -80. ],
...,
[-60.9221, -66.0748],
[-61.0971, -65.9637],
[-61.2706, -65.8803]])
然而,当我取几何平均值时,我得到 NaN:
>>> from scipy import stats as scistats
>>> scistats.gmean(voltages)
array([ NaN, NaN])
有人知道可能是什么原因造成的吗?我做错了什么吗?
提前致谢!
I am using scipy's gmean() function to determine the geometric mean of a numpy array that contains voltage outputs. The range of the numbers is between -80.0 and 30.0. Currently, the numpy array is two dimensional, giving the voltage for two different measurements.
array([[-60.0924, -60.0882],
[-80. , -80. ],
[-80. , -80. ],
...,
[-60.9221, -66.0748],
[-61.0971, -65.9637],
[-61.2706, -65.8803]])
However, I get NaN when I take the geometric mean:
>>> from scipy import stats as scistats
>>> scistats.gmean(voltages)
array([ NaN, NaN])
Does anybody have an idea what might be causing this? Am I doing something wrong?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几何平均值不能应用于负值。
The geometric mean cannot be applied to negative values.