[英]Jupyter Notebook Python error: return_type
I am getting an error regarding return_type
so any help would be much appreciated:)我收到有关
return_type
的错误,因此非常感谢您的帮助:)
Code:代码:
def daily_returns(data, days, iterations):
ft = drift_calc(data, return_type='n')
try:
stv = log_returns(data).std().values
except:
stv = log_returns(data).std()
dr = np.exp(ft + stv * norm.ppf(np.random.rand(days, iterations)))
return dr
daily_returns(data, 50, 1000)
Error:错误:
drift_calc() got an unexpected keyword argument 'return_type'
The problem is exactly what the error message is telling you it is.问题正是错误消息告诉您的内容。 Your
drift_calc
function's signature is as follows, per your comment:根据您的评论,您的
drift_calc
函数的签名如下:
def drift_calc(data):
There is no parameter named return_type
defined here.这里没有定义名为
return_type
的参数。 So this line:所以这一行:
ft = drift_calc(data, return_type='n')
causes the error you're getting, because it is passing the named parameter return_type
to the drift_calc
function, which is not defined as taking such a parameter.导致您遇到的错误,因为它将命名参数
return_type
传递给drift_calc
function,它没有定义为采用这样的参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.