title: KeyError for an object value that is in the dataframe
body: <p>Can someone explain why 'Louisville' is returning a KeyError? It is in the data frame from what I understand. What am I missing?</p>
  
  <p>Here is what the data looks like. It is a CSV.</p>
  
  <p><a href="https://i.stack.imgur.com/6XgaR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6XgaR.png" alt="data"></a></p>
  
  <p>This is what <code>off_data.head()</code> looks like</p>
  
  <p><a href="https://i.stack.imgur.com/Yy0ea.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yy0ea.png" alt="off_data.head()"></a></p>
  
  <p><code>off_data.index()</code></p>
  
  <p><a href="https://i.stack.imgur.com/7jdOj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7jdOj.png" alt="off_data.index()"></a></p>
  
  <p><code>off_data.columns</code></p>
  
  <p><a href="https://i.stack.imgur.com/YuJXn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YuJXn.png" alt="off_data.columns"></a></p>
  
  <pre><code>off_data[0:2].to_dict()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/JYXH0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JYXH0.png" alt="off_data[0:2].to_dict()"></a></p>
  
  <p>Rajith Thennakoon's Suggestion</p>
  
  <p><a href="https://i.stack.imgur.com/bzBSM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bzBSM.png" alt="Rajith Thennakoon&#39;s suggestion"></a></p>
  
  <pre><code>{'Conf': {'Michigan St. ': 'B10', 'Louisville ': 'ACC'},
   'AdjTempo': {'Michigan St. ': 70.4, 'Louisville ': 67.8},
   'AdjOE': {'Michigan St. ': 114.4, 'Louisville ': 113.9},
   'eFG%': {'Michigan St. ': 52.9, 'Louisville ': 60.7},
   'TO%': {'Michigan St. ': 15.9, 'Louisville ': 17.1},
   'OR%': {'Michigan St. ': 37.1, 'Louisville ': 32.8},
   'FTRate': {'Michigan St. ': 30.9, 'Louisville ': 32.5},
   'AdjDE': {'Michigan St. ': 85.1, 'Louisville ': 87.5},
   'deFG%': {'Michigan St. ': 40.3, 'Louisville ': 42.9},
   'dTO%': {'Michigan St. ': 20.7, 'Louisville ': 15.9},
   'dOR%': {'Michigan St. ': 25.0, 'Louisville ': 27.6},
   'dFTRate': {'Michigan St. ': 27.3, 'Louisville ': 26.0}}
  </code></pre>
  
  <p>Input</p>
  
  <pre><code>import pandas as pd
  
  off_data = pd.read_csv(r'C:\Users\westc\Desktop\sports.data\ncaab\kenpomdata\off20.csv', index_col= 'Team')
  
  type(off_data)
  
  off_data.loc["Louisville",0]
  </code></pre>
  
  <h2>Output</h2>
  
  <blockquote>
    <p>KeyError                                  Traceback (most recent call
    last) ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in
    get_loc(self, key, method, tolerance)    2896             try:
    -> 2897                 return self._engine.get_loc(key)    2898             except KeyError:</p>
    
    <p>pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()</p>
    
    <p>pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()</p>
    
    <p>pandas_libs\hashtable_class_helper.pxi in
    pandas._libs.hashtable.PyObjectHashTable.get_item()</p>
    
    <p>pandas_libs\hashtable_class_helper.pxi in
    pandas._libs.hashtable.PyObjectHashTable.get_item()</p>
    
    <p>KeyError: 'Louisville'</p>
    
    <p>During handling of the above exception, another exception occurred:</p>
    
    <blockquote>
      <p>KeyError                                  Traceback (most recent call
      last)  in 
            4 
            5 type(off_data)
      ----> 6 off_data.loc["Louisville",0]</p>
      
      <p>~\Anaconda3\lib\site-packages\pandas\core\indexing.py in
      <strong>getitem</strong>(self, key)    1416                 except (KeyError, IndexError, AttributeError):    1417                     pass
      -> 1418             return self._getitem_tuple(key)    1419         else:    1420             # we by definition only have the 0th axis</p>
      
      <p>~\Anaconda3\lib\site-packages\pandas\core\indexing.py in
      _getitem_tuple(self, tup)
          803     def _getitem_tuple(self, tup):
          804         try:
      --> 805             return self._getitem_lowerdim(tup)
          806         except IndexingError:
          807             pass</p>
      
      <p>~\Anaconda3\lib\site-packages\pandas\core\indexing.py in
      _getitem_lowerdim(self, tup)
          927         for i, key in enumerate(tup):
          928             if is_label_like(key) or isinstance(key, tuple):
      --> 929                 section = self._getitem_axis(key, axis=i)
          930 
          931                 # we have yielded a scalar ?</p>
      
      <p>~\Anaconda3\lib\site-packages\pandas\core\indexing.py in
      _getitem_axis(self, key, axis)    1848         # fall thru to straight lookup    1849         self._validate_key(key, axis)
      -> 1850         return self._get_label(key, axis=axis)    1851     1852 </p>
      
      <p>~\Anaconda3\lib\site-packages\pandas\core\indexing.py in
      _get_label(self, label, axis)
          158             raise IndexingError("no slices here, handle elsewhere")
          159 
      --> 160         return self.obj._xs(label, axis=axis)
          161 
          162     def _get_loc(self, key: int, axis: int):</p>
      
      <p>~\Anaconda3\lib\site-packages\pandas\core\generic.py in xs(self, key,
      axis, level, drop_level)    3735             loc, new_index =
      self.index.get_loc_level(key, drop_level=drop_level)    3736<br>
      else:
      -> 3737             loc = self.index.get_loc(key)    3738     3739             if isinstance(loc, np.ndarray):</p>
      
      <p>~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in
      get_loc(self, key, method, tolerance)    2897                 return
      self._engine.get_loc(key)    2898       `</p>
    </blockquote>
  </blockquote>