在这种情况下如何更改x值?

时间:2019-10-19 14:45:13

标签: python pandas

我收到此错误。如果。iloc是我在另一个问题上看到的答案,那么如何在此处使用.ilocX = X.values

错误:

raise KeyError("{} not found in axis".format(labels[mask]))

KeyError: '[3.0 3.0 1.0 ... 3.0 0.0 3.0] not found in axis'

代码:

forecast_price = 'price'

df.fillna(1, inplace=True)

outcome = int(math.ceil(0.01*(len(df))))

df['label'] = df[forecast_price].shift(-outcome)

df.dropna(inplace=True)

X = np.array(df.drop(df['label'],1))

y = np.array(df['label'])

x = preprocessing.scale(X)

df.dropna(inplace=True)

y = np.array(df['label'])

0 个答案:

没有答案