title: ValueError: Expected 2D array, got 1D array instead: for the matrix?
body: <p>I get the following error and unsure as to why? ValueError: Expected 2D array, got 1D array instead:
  The dataset I used is <a href="https://catalog.data.gov/dataset/demographic-statistics-by-zip-code-acfc9" rel="nofollow noreferrer">https://catalog.data.gov/dataset/demographic-statistics-by-zip-code-acfc9</a></p>
  
  <p>I thought it was already converted to a matrix once it is in the dataframe. Especially because the plot data shows up correctly.</p>
  
  <p>Any help would be appreciated. </p>
  
  <pre><code>#implmenting KNN in python
  import pandas as pd
  import numpy as np
  import operator
  import seaborn as sns
  import matplotlib.pyplot as plt
  import matplotlib.cbook as cbook
  import time
  start_time = time.time()
  
  #1) Ingest the data via one of the provided formats.
  
  print("Getting csv")
  ###################################
  #2.) Create a data structure to store the data.
  data = pd.read_csv(r"C:\Users\trave.DESKTOP-KM5AM0U\Desktop\UNIT 5\Demographic_Statistics_By_Zip_Code.csv", usecols = ["COUNT PARTICIPANTS", "PERCENT RECEIVES PUBLIC ASSISTANCE"])
  #msft.plot("JURISDICTION NAME", ["COUNT PUBLIC ASSISTANCE TOTAL", "COUNT PARTICIPANTS"], subplots=True)
  # print("Entering data to datfram only 3 columns")
  # print ("The number of rows is")
  # print (len(data.index))
  # print ("The number of columns is")
  # print (len(data.columns))
  print(data.head)
  
  #################
  print("running plots")
  #scikit-learn
  #####################################
  #MATPLOT FOR REGRESSION LINE DATA
  Par = data.iloc[:, 0]
  
  Per = data.iloc[:, 1]
  
  # Count_P = data[]
  # Public_Aid = data[]
  
  
  
  plt.title('Number of people to public aid percentage')
  plt.xlabel('#Participant')
  plt.ylabel('% Public aid')
  
  plt.plot (Par, Per, 'k.')
  
  plt.axis([.1,200,.1,1])
  plt.grid(True)
  
  print("plots complete")
  
  
  ###################################
  print("sklearn running")
  
  from  sklearn.linear_model import LinearRegression
  model = LinearRegression()
  model.fit (X=Par, y=Per)
  
  print('SKLEARN MODULE COMPLETE')
  #########################################
  ####making prediction
  print("running prediction")
  
  p = model.predict ([[78]]) [0][0]
  print (round(p,2))
  
  
  
  
  
  # STOP MY TIMER
  print ("My program took", time.time() - start_time, "to run")
  </code></pre>