Cannot predict the prices using the date parameter #importing the libraries
import pandas as pd
import matplotlib as plt
import numpy as np

#getting the dataset
ds = pd.read_csv("data.csv")
ds['Date'] = pd.datetime.date(ds.Date,format ='%m-%d-%Y')
X = ds.iloc[:, 0].values
Y = ds.iloc[:, 1].values

#spliting the data into train and test 
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test = train_test_split(X,Y,test_size=0.2,random_state=0)
X_train = X_train.reshape(-1,1)

#scaling the features of the data
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
y_train = sc.fit_transform(y_train)

from sklearn.linear_model import LinearRegression
regressor = LinearRegression()
regressor.fit(X_train,y_train)

#predicting the value 
y_pred = regressor.predict(y_train)

#plootting the graph 
plt.scatter(y_train,color ="red")
plt.plot(regressor.predict(y_train), color ="blue")
plt.title("prediction ")
plt.xlabel("date")
plt.ylabel("stock prices")
plt.show()
Your problem is with the date field?

In Machine Learning algorithms you have to feed the model with numerical data and date is not numerical. You can see in this posts what are the common techniques of encoding time: https://stats.stackexchange.com/questions/311494/best-practice-for-encoding-datetime-in-machine-learning

So you have either two options: encoding date time or drop it.

ds = ds.drop('Date', axis=1)