`dtype='numeric' is not compatible with arrays of bytes/strings.Convert your data to numeric values explicitly instead.`

16 views Asked by At

ValueError: dtype='numeric' is not compatible with arrays of bytes/strings.Convert your data to numeric values explicitly instead.

`@app.route('/predict', methods=['GET', 'POST']) def predict_placement(): ans = request.form.get("msg")

result = model.predict(np.array([ans]).reshape(-1, 1))`

I'm taking a string input in Html form and getting this error, how to resolve this?

1

There are 1 answers

0
DataSciRookie On

The data you give for you predict is in the format string, however your model can only deal with numerical data. You should try to do some encoding for your features before passing it to your predict.