KeyError:“在轴中找不到[[Survived']]”

时间:2019-12-08 12:59:43

标签: python

运行以下代码时,我收到一条消息KeyError:“在轴中找不到[[Survived]]”。有什么想法请问为什么?

train_x_all = train_raw_data_all.drop('Survived', axis = 1)
train_y_all = train_raw_data_all['Survived']

test_x_all = test_raw_data_all.drop('Survived', axis = 1)
test_y_all = test_raw_data_all['Survived']

Real_predict = test_raw_data_all

X_train, X_valid, y_train, y_valid = train_test_split(train_x_all, train_y_all, test_size=0.2, shuffle=True, random_state=78)

###For xgboost
X_train_xg = np.array(X_train)
X_valid_xg = np.array(X_valid)
y_train_xg = np.array(y_train)
y_valid_xg = np.array(y_valid)
X_test_xg = np.array(test_x_all)
X_test_xg = np.array(test_y_all)

0 个答案:

没有答案