title: TypeError: unhashable type: 'slice'
body: <p>I am trying to run a regression using the following dataframe <code>dfMyRoll</code> the head of the dataframe looks like:</p>
  <pre><code>                SCORE  SCORE_LAG
  date                           
  2007-10-29 -0.031551        NaN
  2007-10-30  0.000100  -0.031551
  2007-10-31  0.000100   0.000100
  2007-11-01  0.000100   0.000100
  2007-11-02  0.000100   0.000100 
  </code></pre>
  <p>The code that I am using is :</p>
  <pre><code>import glob
  import pandas as pd 
  import os.path
  import scipy
  from scipy.stats import linregress
  
  def main():
          
      dataPath = &quot;C:/Users/Stacey/Documents/data/Roll&quot;
      roll = 4
      1ID = &quot;BBG.XNGS.AAPL.S&quot;
      2ID = &quot;BBG.XNGS.AMAT.S&quot;
      print(1ID,1ID)
      cointergration = getCointergration(dataPath,1ID,2ID,roll)
      
      return
  
  def getCointergration(dataPath,1ID,2ID,roll):
     
      for myRoll in range((roll-4),roll,1):
          path = dataPath+str(myRoll)+'/'
          filename='PairData_'+1ID+'_'+2ID+'.csv'
          
          for fname in glob.iglob(path+filename):
              
              dfMyRoll = pd.read_csv(fname, header=0, usecols=[0,31],parse_dates=[0], dayfirst=True,index_col=[0], names=['date', 'SCORE'])
              dfMyRoll['SCORE_LAG'] = dfMyRoll['SCORE'].shift(1)
              print('cointergration',dfMyRoll.head())
           
              X = dfMyRoll[1:,'SCORE']
              
              Y = dfMyRoll[1:,'SCORE_LAG']
            slope,intercept,_,_,stderr=linregress(dfMyRoll[1:,'SCORE'],dfMyRoll[1:,'SCORE_LAG'])
  
  if __name__ == &quot;__main__&quot;:
      
      print (&quot;CointergrationTest...19/05/17&quot;)
  
      try:
          
          main()
  
      except KeyboardInterrupt:
          
          print (&quot;Ctrl+C pressed. Stopping...&quot;)  
  
    
  </code></pre>
  <p>I get the error: <code>TypeError: unhashable type: 'slice'</code>.  I have looked at previous posts on this subject and tried adding iloc to the X and Y time series in the following way:</p>
  <pre><code>        X = dfMyRoll.iloc[1:,'SCORE']
          
          Y = dfMyRoll.iloc[1:,'SCORE_LAG']
  </code></pre>
  <p>but unfortunately I can't seem to find a solution.  Please see below for a stack trace:</p>
  <pre><code>Traceback (most recent call last):
  
    File &quot;&lt;ipython-input-3-431422978139&gt;&quot;, line 1, in &lt;module&gt;
      runfile('C:/Users/Stacey/Documents/scripts/cointergrationTest.py', wdir='C:/Users/Stacey/Documents/scripts')
  
    File &quot;C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py&quot;, line 866, in runfile
      execfile(filename, namespace)
  
    File &quot;C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py&quot;, line 102, in execfile
      exec(compile(f.read(), filename, 'exec'), namespace)
  
    File &quot;C:/Users/Stacey/Documents/scripts/cointergrationTest.py&quot;, line 64, in &lt;module&gt;
      main()
  
    File &quot;C:/Users/Stacey/Documents/scripts/cointergrationTest.py&quot;, line 23, in main
      cointergration = getCointergration(dataPath,1ID,2ID,roll)
  
    File &quot;C:/Users/Stacey/Documents/scripts/cointergrationTest.py&quot;, line 42, in getCointergration
      X = dfMyRoll[1:,'SCORE']
  
    File &quot;C:\Anaconda\lib\site-packages\pandas\core\frame.py&quot;, line 2059, in __getitem__
      return self._getitem_column(key)
  
    File &quot;C:\Anaconda\lib\site-packages\pandas\core\frame.py&quot;, line 2066, in _getitem_column
      return self._get_item_cache(key)
  
    File &quot;C:\Anaconda\lib\site-packages\pandas\core\generic.py&quot;, line 1384, in _get_item_cache
      res = cache.get(item)
  
  TypeError: unhashable type: 'slice'
  </code></pre>