ValueError: Expected 2D array, got scalar array instead using predict method
Try:

Y_pred = regressor.predict(np.array([6.5]).reshape(1, 1))


Scikit does not work with scalars (just one single value). It expects a shape $(m\times n)$ where $m$ is the number of features and $n$ is the number of observations, both are 1 in your case.