Skip to content
Advertisement

Input data cannot be a list XGBoost

Here is my code.

JavaScript

and the error I’m getting is TypeError: Input data can not be a list.

The data coming from test_data is a csv with a team name and obs which is a float like this NYY 0.324

Every way to solve it I’ve seen is just to put it in a 2d array like I did – Xnew = [[ OBS ]], but I’m still getting the error.

Is there something else I need to do to the test_data coming in? I tried using values.reshape, but that didn’t fix it either.

Advertisement

Answer

You need to transform your Xnew:

JavaScript
Advertisement