Error codes:
new_x = 84610
pre_y = model.predict(new_x)
print(pre_y)
Error results:
ValueError: Expected 2D array, got scalar array instead:
array=84610.
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
Solutions:
Error value: should be a two-dimensional array, one-dimensional array is obtained:
using array readjust the shape data. If there is a single function or a data array, the shape of the re-adjustment (1,1). If the data contains a single example, re-adjust the shape (1, -1).
solution:
Plus
new_x = np.array(new_x).reshape(1, -1)
The revised Code:
new_x = 84610
new_x = np.array(new_x).reshape(1, -1)
pre_y = model.predict(new_x)
print(pre_y)