[英]__init__() got multiple values for argument 'use_technical_indicator' - error
I can't figure out why I am getting this error.我不知道为什么我会收到这个错误。 If you can figure it out, I'd appreciate it.
如果你能弄清楚,我将不胜感激。 If you can provide specific instruction, I'd appreciate it.
如果您能提供具体的指导,我将不胜感激。 This code is in one module;
此代码在一个模块中; there are 7 modules total.
共有7个模块。
Python 3.7, Mac OS, code from www.finrl.org
Python 3.7,Mac OS,代码来自www.finrl.org
# Perform Feature Engineering:
df = FeatureEngineer(df.copy(),
use_technical_indicator=True,
use_turbulence=False).preprocess_data()
# add covariance matrix as states
df=df.sort_values(['date','tic'],ignore_index=True)
df.index = df.date.factorize()[0]
cov_list = []
# look back is one year
lookback=252
for i in range(lookback,len(df.index.unique())):
data_lookback = df.loc[i-lookback:i,:]
price_lookback=data_lookback.pivot_table(index = 'date',columns = 'tic', values = 'close')
return_lookback = price_lookback.pct_change().dropna()
covs = return_lookback.cov().values
cov_list.append(covs)
df_cov = pd.DataFrame({'date':df.date.unique()[lookback:],'cov_list':cov_list})
df = df.merge(df_cov, on='date')
df = df.sort_values(['date','tic']).reset_index(drop=True)
df.head()
The function definition statement for FeatureEngineer.__init__
is : FeatureEngineer.__init__
的 function 定义语句是:
def __init__(
self,
use_technical_indicator=True,
tech_indicator_list=config.TECHNICAL_INDICATORS_LIST,
use_turbulence=False,
user_defined_feature=False,
):
As you can see there is no argument (other than self which you should not provide) before use_technical_indicator
, so you should remove the df.copy() from before the use_techincal_indicator
in your line 2.如您所见,在
use_technical_indicator
之前没有任何参数(除了您不应该提供的 self ),因此您应该从第 2 行中的use_techincal_indicator
之前删除 df.copy() 。
Checking the current FeatureEngineer class , you must to provide the df.copy()
parameter to the preprocess_data()
method.检查当前FeatureEngineer class ,您必须向
preprocess_data()
方法提供df.copy()
参数。
So, your code have to look like:因此,您的代码必须如下所示:
# Perform Feature Engineering:
df = FeatureEngineer(use_technical_indicator=True,
tech_indicator_list = config.TECHNICAL_INDICATORS_LIST,
use_turbulence=True,
user_defined_feature = False).preprocess_data(df.copy())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.