title: NameError: name 'x_train' is not defined
body: <p>i'm new to this but can anyone tell me what's wrong it? I'm actually trying to do a predictive analysis(linear regression graph) based on the data i have in the excel . However , my graph isn't plotted out and i also faced this error. </p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  import scipy
  from sklearn import linear_model
  df = pd.read_csv("C:\MongoDB\MongoData.csv") 
  
  x_train = np.array(x_train).reshape(len(x_train), -1)
  x_train.shape
  y_train= [1,2,3,4,5]
  x_test = x_test.reshape(-1, 1)
  x_test.shape
  
  linear = linear_model.LinearRegression()
  
  linear.fit(x_train, y_train)
  linear.score(x_train, y_train)
  
  print('Coefficient: \n', linear.coef_)
  print('Intercept: \n', linear.intercept_)
  
  predicted= linear.predict(x_test)
  </code></pre>