y_pred = regressor.predict(6.5) not working : """
whenever I am going to predict, I saw an error. 
I am stuck with the line "y_pred = regressor.predict(6.5)" in the code.
I am getting the error:
"ValueError: Expected 2D array, got scalar array instead:
array=6.5.
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."
"""


Any help would be appreciated. Thank you.


spyder

    # SVR
    
    # Importing the libraries

    import numpy as np
    import matplotlib.pyplot as plt
    import pandas as pd

    # Importing the dataset
    dataset = pd.read_csv('Position_Salaries.csv')
    X = dataset.iloc[:, 1:2].values
    y = dataset.iloc[:, 2].values


    # Feature Scaling
    from sklearn.preprocessing import StandardScaler
    sc_X = StandardScaler()
    sc_y = StandardScaler()
    X = sc_X.fit_transform(X)
    y = sc_y.fit_transform(y)
    
    # Fitting SVR to the dataset
    from sklearn.svm import SVR
    regressor = SVR(kernel = 'rbf')
    regressor.fit(X, y)
    
    # Predicting a new result
    y_pred = regressor.predict(6.5)





"""
y_pred = regressor.predict(6.5)

Traceback (most recent call last):

  File "<ipython-input-10-5865c008a8c9>", line 1, in <module>
    y_pred = regressor.predict(6.5)

  File "C:\Users\achiever\Anaconda3\lib\site-packages\sklearn\svm\base.py", line 322, in predict
    X = self._validate_for_predict(X)

  File "C:\Users\achiever\Anaconda3\lib\site-packages\sklearn\svm\base.py", line 454, in _validate_for_predict
    accept_large_sparse=False)

  File "C:\Users\achiever\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 514, in check_array
    "if it contains a single sample.".format(array))

ValueError: Expected 2D array, got scalar array instead:
array=6.5.
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."""