Reputation: 1
I am using XGBoost model for my data. I need to collect all the received values in a Dataframe.
x_train (pandas.core.frame.DataFrame) is 9 columns,
pred_prob (numpy.ndarray) is 5 columns,
y_test (numpy.ndarray) is 1 column,
pred (numpy.ndarray) is 1 column.
How can i do this?
When trying to build pred_prob, y_test, pred,
df = pd.DataFrame (np.concatenate (pred_prob, pred, y_test), axis = 0)
the following error occurs:
TypeError: only integer scalar arrays can be converted to a scalar index
Upvotes: 0
Views: 86
Reputation: 2118
Give a tuple of ndarrays and axis=1 to np.concatenate (works only if ndarrays have same number of rows) :
df = pd.DataFrame(np.concatenate((pred_prob, pred, y_test), axis=1))
Upvotes: 1