简体   繁体   English

类型错误:python 中需要一个浮点数

[英]TypeError: a float is required in python

def calculateProbability(x, mean, stdev):
    exponent = math.exp(-(math.pow(x-mean,2)/(2*math.pow(stdev,2))))
    return (1 / (math.sqrt(2*math.pi) * stdev)) * exponent


exponent = math.exp(-(math.pow(x-mean,2)/(2*math.pow(stdev,2))))

TypeError: a float is required类型错误:需要一个浮点数

Make sure the three input parameters x,mean,stdev are integer/float.确保三个输入参数x,mean,stdevinteger/float.

It is most likely that one/more of them is not in your case.其中一个/多个很可能不是您的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM