title: error: list indices must be integers, not float', u'occurred at index 0. Python 3.x
body: <p>Trying to apply a tutorial to some of my own data. Tutorial link: 
  <a href="https://github.com/brendonhall/facies_classification/blob/master/Facies%20Classification%20-%20SVM.ipynb" rel="nofollow noreferrer">https://github.com/brendonhall/facies_classification/blob/master/Facies%20Classification%20-%20SVM.ipynb</a></p>
  
  <p>I am up to the in[3] code box. </p>
  
  <p>When attempting to define the colour map for use in plotting I get the error "TypeError: ('list indices must be integers, not float', u'occurred at index 0') "</p>
  
  <p>I have pasted my code below. Thanks in advance, </p>
  
  <pre><code>import pandas as pd
  
  # Load data
  data = pd.read_csv('BHPAND.csv')
  data.describe()
  data['BH'] = data['BH'].astype('category')
  data['FM'] = data['FM'].astype('category')
  data['SBTN'] = data['SBTN'].astype('category')
  # Set names of Borehole UID's
  data['BH'].unique()
  
  # Define colours for facies based on SBTn
  # 1=sensitive fine grained  2=organic clay   3=silty clay to clay 
  # 4=silt mixtures 5=sand mixtures 6=sands 7=gravelly sand
  # 8=very stiff sand/clay sand 9=highly overconsolidated fine grained
  sbtn_colours = ['#5E5E56', '#1E1E1C','#AAAA96','#788E6D',
         '#C6C57D','#FFFC3F', '#AED6F1', '#BA4D2C', '#FF008C']
  sbtn_labels = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
  #sbtn_colour_map = dictionary that maps sbtn labels to colours
  sbtn_colour_map = {}
  for ind, label in enumerate(sbtn_labels):
      sbtn_colour_map[label] = sbtn_colours[ind]
  
  def label_sbtn(row, labels):
      return labels[ row['SBTN'] -1]
  
  data.loc[:,'sbtnLabels'] = data.apply(lambda row: label_sbtn(row, sbtn_labels), axis=1)
  </code></pre>
  
  <p>When checking my data types I can see that the SBTN is recorded as a category:</p>
  
  <pre><code>data.dtypes
  Out[##]: 
  BH       category
  MD        float64
  DR        float64
  FM       category
  RHOB      float64
  M_MOD     float64
  PHI       float64
  RES       float64
  SBTN     category
  SU        float64
  VP        float64
  Z         float64
  dtype: object
  </code></pre>
  
  <p>Is the problem here that my column SBTN is a category not an int? Basically I want to define a colour map using my hex colours for each SBTN type. In the original csv file SBTN is an integer. </p>
  
  <p>Full error traceback: </p>
  
  <pre><code>        %run "C:\Users\black\Desktop\Pandas Facies\script1.py"
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  C:\Users\black\Desktop\Pandas Facies\script1.py in &lt;module&gt;()
       25     return labels[ row['SBTN'] -1]
       26 
  ---&gt; 27 data.loc[:,'sbtnLabels'] = data.apply(lambda row: label_sbtn(row, sbtn_labels), axis=1)
       28 
       29 
  
  C:\Users\black\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\core\frame.pyc in apply(self, func, axis, broadcast, raw, reduce, args, **kwds)
     4150                     if reduce is None:
     4151                         reduce = True
  -&gt; 4152                     return self._apply_standard(f, axis, reduce=reduce)
     4153             else:
     4154                 return self._apply_broadcast(f, axis)
  
  C:\Users\black\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\core\frame.pyc in _apply_standard(self, func, axis, ignore_failures, reduce)
     4246             try:
     4247                 for i, v in enumerate(series_gen):
  -&gt; 4248                     results[i] = func(v)
     4249                     keys.append(v.name)
     4250             except Exception as e:
  
  C:\Users\black\Desktop\Pandas Facies\script1.py in &lt;lambda&gt;(row)
       25     return labels[ row['SBTN'] -1]
       26 
  ---&gt; 27 data.loc[:,'sbtnLabels'] = data.apply(lambda row: label_sbtn(row, sbtn_labels), axis=1)
       28 
       29 
  
  C:\Users\black\Desktop\Pandas Facies\script1.py in label_sbtn(row, labels)
       23 
       24 def label_sbtn(row, labels):
  ---&gt; 25     return labels[ row['SBTN'] -1]
       26 
       27 data.loc[:,'sbtnLabels'] = data.apply(lambda row: label_sbtn(row, sbtn_labels), axis=1)
  
  TypeError: ('list indices must be integers, not float', u'occurred at index 0') 
  </code></pre>