title: why i can't predict my x value in linear regression model using reg.predict ( )
body: <pre><code>[c:\Users\ACER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\base.py:450: UserWarning: X does not have valid feature names, but LinearRegression was fitted with feature names
    warnings.warn(
  Output exceeds the size limit. Open the full output data in a text editor
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  d:\python\tugas PTI\coba coding.ipynb Cell 5 in &lt;cell line: 1&gt;()
  ----&gt; 1 reg.predict(2600)
  
  File c:\Users\ACER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\linear_model\_base.py:386, in LinearModel.predict(self, X)
      372 def predict(self, X):
      373     &quot;&quot;&quot;
      374     Predict using the linear model.
      375 
     (...)
      384         Returns predicted values.
      385     &quot;&quot;&quot;
  --&gt; 386     return self._decision_function(X)
  
  File c:\Users\ACER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\linear_model\_base.py:369, in LinearModel._decision_function(self, X)
      366 def _decision_function(self, X):
      367     check_is_fitted(self)
  --&gt; 369     X = self._validate_data(X, accept_sparse=[&quot;csr&quot;, &quot;csc&quot;, &quot;coo&quot;], reset=False)
      370     return safe_sparse_dot(X, self.coef_.T, dense_output=True) + self.intercept_
  
  File c:\Users\ACER\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\base.py:577, in BaseEstimator._validate_data(self, X, y, reset, validate_separately, **check_params)
      575     raise ValueError(&quot;Validation should be done on X, y or both.&quot;)
      576 elif not no_val_X and no_val_y:
  --&gt; 577     X = check_array(X, input_name=&quot;X&quot;, **check_params)
  ...
      878     if array.ndim == 1:
  
  ValueError: Expected 2D array, got scalar array instead:
  array=2600.
  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.
  </code></pre>
  <p><a href="https://i.stack.imgur.com/oJAOz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJAOz.png" alt="" /></a></p>