title: TypeError: unhashable type
body: <p>I wrote a small piece of code to do linear regression using sklearn.</p>
  
  <p>I created a 2 column csv file (column names X,Y with some numbers) and
  when I read the file I see that the content is properly read - as shown below.</p>
  
  <p>However, I am getting "unhashable type" error when I try to refer to a column using the commands <code>datafile[:,:]</code> or <code>datafile[:,-1]</code> etc.. </p>
  
  <p>And when I try to use X as response, Y as predictor in sklearn's linear regression, I am getting Value error as shown below.</p>
  
  <p>I looked online but not able to figure out what is wrong with my code or file. Please help.</p>
  
  <pre><code>import pandas as pd
  datafile=pd.read_csv('samplelinear.csv')
  datafile
  
       X    Y    
  0    0 1.440000 
  1    1 33.220000 
  . . . 
  
  print datafile.__class__
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  
  datafile[:,:]
  TypeError: unhashable type
  
  datafile[:,:1]
  TypeError: unhashable type
  
  
  from sklearn.linear_model import LinearRegression
  model=LinearRegression()
  
  model.fit(datafile.X,datafile.Y)
  ValueError: Found arrays with inconsistent numbers of samples: [ 1 14]
  </code></pre>