我正在使用sklearn,但有:

regressor = RandomForestRegressor(
    n_estimators=10, random_state=0, verbose=1, n_jobs=-1)
regressor.fit(X_train, np.ravel(y_train))
y_pred = regressor.predict(X_test)


我的y_predshape(3000,)

我想将该列添加回标题为X_testjob_performance,然后最后另存为CSV。有人能帮忙吗?

最佳答案

然后像这样保存到csv

X_test['job_perf'] = y_pred
X_test.to_csv('filename.csv')

10-04 17:04