title: ValueError while implementing the train_test_split
body: <p>I'm following through the Machine Learning tutorial on Kaggle and I have a <code>ValueError</code> despite following the tutorial line by line.  I'm trying to practice data validation with splitting.  This is my code:</p>
  
  <pre><code>import pandas as pd
  from sklearn.tree import DecisionTreeRegressor
  from sklearn.model_selection import train_test_split
  
  
  main_file_path = '../input/train.csv'
  data = pd.read_csv(main_file_path)
  
  y = data.SalePrice
  
  data_predictors = ['LotArea', 'YearBuilt', '1stFlrSF', '2ndFlrSF', 'FullBath', 'BedroomAbvGr', 'TotRmsAbvGrd']
  x = data[data_predictors]
  
  train_x, val_x, train_y, val_x = train_test_split(x, y,random_state = 0)
  
  data_model = DecisionTreeRegressor()
  data_model.fit(train_x,train_y)
  
  data_prediction = data_model.predict(val_x)
  print(mean_absolute_error(val_y, data_prediction))
  </code></pre>
  
  <p>The error is pointing at this line:</p>
  
  <pre><code>data_prediction = data_model.predict(val_x)
  </code></pre>
  
  <p>I'm a beginner in ML learning so I compared my code with that of the authors and the implementations were the same.</p>
  
  <p>Full stack trace:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-3-48f37072f996&gt; in &lt;module&gt;()
       17 data_model.fit(train_x,train_y)
       18 
  ---&gt; 19 data_prediction = data_model.predict(val_x)
       20 print(mean_absolute_error(val_y, data_prediction))
  
  /opt/conda/lib/python3.6/site-packages/sklearn/tree/tree.py in predict(self, X, check_input)
      410         """
      411         check_is_fitted(self, 'tree_')
  --&gt; 412         X = self._validate_X_predict(X, check_input)
      413         proba = self.tree_.predict(X)
      414         n_samples = X.shape[0]
  
  /opt/conda/lib/python3.6/site-packages/sklearn/tree/tree.py in _validate_X_predict(self, X, check_input)
      371         """Validate X whenever one tries to predict, apply, predict_proba"""
      372         if check_input:
  --&gt; 373             X = check_array(X, dtype=DTYPE, accept_sparse="csr")
      374             if issparse(X) and (X.indices.dtype != np.intc or
      375                                 X.indptr.dtype != np.intc):
  
  /opt/conda/lib/python3.6/site-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
      439                     "Reshape your data either using array.reshape(-1, 1) if "
      440                     "your data has a single feature or array.reshape(1, -1) "
  --&gt; 441                     "if it contains a single sample.".format(array))
      442             array = np.atleast_2d(array)
      443             # To ensure that array flags are maintained
  
  ValueError: Expected 2D array, got 1D array instead:
  </code></pre>