title: Python - linear regression TypeError: invalid type promotion
body: <p>i am trying to run linear regression and i am having issues with data type i think. I have tested line by line and everything works until i reach last line where i get the issue TypeError: invalid Type promotion. Based on my research i think it is due to date format.<br>
  Here is my code:</p>
  
  <pre><code>import pandas as pd
  import numpy as np  
  import matplotlib.pyplot as plt
  from sklearn.model_selection import train_test_split 
  from sklearn.linear_model import LinearRegression
  data=pd.read_excel('C:\\Users\\Proximo\\PycharmProjects\Counts\\venv\\Counts.xlsx')  
  data['DATE'] = pd.to_datetime(data['DATE'])
  data.plot(x = 'DATE', y = 'COUNT', style = 'o')
  plt.title('Corona Spread Over the Time')
  plt.xlabel('Date')
  plt.ylabel('Count')
  plt.show()
  
  X=data['DATE'].values.reshape(-1,1)
  y=data['COUNT'].values.reshape(-1,1)
  X_train,X_test,Y_train,Y_test=train_test_split(X,y,test_size=.2,random_state=0)
  regressor = LinearRegression()  
  regressor.fit(X_train,Y_train)
  y_pre = regressor.predict(X_test)
  </code></pre>
  
  <p>When i run it this is the full error i get:</p>
  
  <pre><code>    ---------------------------------------------------------------------------
  
  TypeError                                 Traceback (most recent call last)
  
  &lt;ipython-input-21-c9e943251026&gt; in &lt;module&gt;
  ----&gt; 1 y_pre = regressor.predict(X_test)
        2 
  
  c:\users\slavi\pycharmprojects\coronavirus\venv\lib\site-packages\sklearn\linear_model\_base.py in predict(self, X)
      223             Returns predicted values.
      224         """
  --&gt; 225         return self._decision_function(X)
      226 
      227     _preprocess_data = staticmethod(_preprocess_data)
  
  c:\users\slavi\pycharmprojects\coronavirus\venv\lib\site-packages\sklearn\linear_model\_base.py in _decision_function(self, X)
      207         X = check_array(X, accept_sparse=['csr', 'csc', 'coo'])
      208         return safe_sparse_dot(X, self.coef_.T,
  --&gt; 209                                dense_output=True) + self.intercept_
      210 
      211     def predict(self, X):
  
  c:\users\Proximo\pycharmprojects\Count\venv\lib\site-packages\sklearn\utils\extmath.py in safe_sparse_dot(a, b, dense_output)
      149             ret = np.dot(a, b)
      150     else:
  --&gt; 151         ret = a @ b
      152 
      153     if (sparse.issparse(a) and sparse.issparse(b)
  
  TypeError: invalid type promotion
  </code></pre>
  
  <p>My date format which looks like this:</p>
  
  <pre><code>array([['2020-01-20T00:00:00.000000000'],
     ['2020-01-21T00:00:00.000000000'],
     ['2020-01-22T00:00:00.000000000'],
     ['2020-01-23T00:00:00.000000000'],
     ['2020-01-24T00:00:00.000000000'],
     ['2020-01-25T00:00:00.000000000'],
     ['2020-01-26T00:00:00.000000000'],
     ['2020-01-27T00:00:00.000000000'],
     ['2020-01-28T00:00:00.000000000'],
     ['2020-01-29T00:00:00.000000000'],
     ['2020-01-30T00:00:00.000000000'],
     ['2020-01-31T00:00:00.000000000'],
     ['2020-02-01T00:00:00.000000000'],
     ['2020-02-02T00:00:00.000000000']], dtype='datetime64[ns]')
  </code></pre>
  
  <p>Any suggestion on how to resolve this issue?</p>