title: pandas.errors.InvalidIndexError: (slice(None, None, None), None)
body: <p>this is my model for LinearRegression of salary pridict for pratcit but gating a error <code>pl.plot(x_train, model.predict(x_train))</code></p>
  <pre><code>import pandas as pd
  from sklearn.linear_model import LinearRegression
  from sklearn.model_selection import train_test_split
  
  df = pd.read_csv('Salary_Data.csv')
  x = df[['YearsExperience']]
  y = df['Salary']
  
  x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=.2, random_state=0)
  
  model = LinearRegression().fit(x_train,y_train)
  
  import matplotlib.pyplot as plt
  pl = plt
  pl.scatter(x_train, y_train)
  pl.plot(x_train, model.predict(x_train))
  pl.show()
  </code></pre>
  <p>this is data iam using</p>
  <pre><code>YearsExperience,Salary
  1.1,39343.00
  1.3,46205.00
  1.5,37731.00
  2.0,43525.00
  2.2,39891.00
  2.9,56642.00
  3.0,60150.00
  3.2,54445.00
  3.2,64445.00
  3.7,57189.00
  3.9,63218.00
  4.0,55794.00
  4.0,56957.00
  4.1,57081.00
  4.5,61111.00
  4.9,67938.00
  5.1,66029.00
  5.3,83088.00
  5.9,81363.00
  6.0,93940.00
  6.8,91738.00
  7.1,98273.00
  7.9,101302.00
  8.2,113812.00
  8.7,109431.00
  9.0,105582.00
  9.5,116969.00
  9.6,112635.00
  10.3,122391.00
  10.5,121872.00
  </code></pre>
  <p>this is error iam fasing</p>
  <pre><code>Traceback (most recent call last):
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\pandas\core\indexes\base.py&quot;, line 3621, in get_loc
      return self._engine.get_loc(casted_key)
    File &quot;pandas\_libs\index.pyx&quot;, line 136, in pandas._libs.index.IndexEngine.get_loc      
    File &quot;pandas\_libs\index.pyx&quot;, line 142, in pandas._libs.index.IndexEngine.get_loc      
  TypeError: '(slice(None, None, None), None)' is an invalid key
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;d:\Project\data scince\main.py&quot;, line 16, in &lt;module&gt;
      pl.plot(x_train, model.predict(x_train))
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\matplotlib\pyplot.py&quot;, line 2757, in plot
      return gca().plot(
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\matplotlib\axes\_axes.py&quot;, line 1632, in plot
      lines = [*self._get_lines(*args, data=data, **kwargs)]
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\matplotlib\axes\_base.py&quot;, line 312, in __call__
      yield from self._plot_args(this, kwargs)
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\matplotlib\axes\_base.py&quot;, line 487, in _plot_args
      x = _check_1d(xy[0])
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\matplotlib\cbook\__init__.py&quot;, line 1327, in _check_1d
      ndim = x[:, None].ndim
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\pandas\core\frame.py&quot;, line 3505, in __getitem__
      indexer = self.columns.get_loc(key)
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\pandas\core\indexes\base.py&quot;, line 3628, in get_loc
      self._check_indexing_error(key)
    File &quot;D:\Softwers\Python_3.9\lib\site-packages\pandas\core\indexes\base.py&quot;, line 5637, in _check_indexing_error
      raise InvalidIndexError(key)
  pandas.errors.InvalidIndexError: (slice(None, None, None), None)
  </code></pre>