title: Accessing a Pandas index like a regular column
body: <p>I have a Pandas DataFrame with a named index. I want to pass it off to a piece off code that takes a DataFrame, a column name, and some other stuff, and does a bunch of work involving that column. Only in this case the column I want to highlight is the index, but giving the index's label to this piece of code doesn't work because you can't extract an index like you can a regular column. For example, I can construct a DataFrame like this:</p>
  
  <pre><code>import pandas as pd, numpy as np
  
  df=pd.DataFrame({'name':map(chr, range(97, 102)), 'id':range(10000,10005), 'value':np.random.randn(5)})
  df.set_index('name', inplace=True)
  </code></pre>
  
  <p>Here's the result:</p>
  
  <pre><code>         id     value
  name                 
  a     10000  0.659710
  b     10001  1.001821
  c     10002 -0.197576
  d     10003 -0.569181
  e     10004 -0.882097
  </code></pre>
  
  <p>Now how am I allowed to go about accessing the <code>name</code> column?</p>
  
  <pre><code>print(df.index)  # No problem
  print(df['name'])  # KeyError: u'name'
  </code></pre>
  
  <p>I know there are workaround like duplicating the column or changing the index to something else. But is there something cleaner, like some form of column access that treats the index the same way as everything else?</p>