title: How do I really use the `ix` method of a pandas DataFrame?
body: <p>Note: since I asked this question, <code>.ix</code> still exists but more or less has been replaced by <code>.loc</code> for label-based indexing and <code>.iloc</code> for positional indexing.</p>
  
  <hr>
  
  <p><a href="http://pandas.pydata.org/pandas-docs/stable/indexing.html#advanced-indexing-with-hierarchical-index" rel="nofollow">Having read the docs one the <code>ix</code> method of DataFrames</a>, I'm a bit confused by the following behavior with my MultiIndexed DataFrame (specifying select columns of the index).</p>
  
  <pre><code>In [57]: metals
  Out[57]: 
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  MultiIndex: 24245 entries, (u'BI', u'Arsenic, Dissolved', -2083768576.0, 1.0) 
                          to (u'WC', u'Zinc, Total',         1661183104.0, 114.0)
  Data columns:
  Inflow_val      20648  non-null values
  Outflow_val     20590  non-null values
  Inflow_qual     20648  non-null values
  Outflow_qual    20590  non-null values
  dtypes: float64(2), object(2)
  
  In [58]: metals.ix['BI'].shape  # first column in the index, ok
  Out[58]: (3368, 4)
  
  In [59]: metals.ix['BI', :, :, :].shape  # first + other columns, ok
  Out[59]: (3368, 4)
  
  In [60]: metals.ix['BI', 'Arsenic, Dissolved'].shape # first two cols
  Out[60]: (225, 4)
  
  In [61]: metals.ix['BI', 'Arsenic, Dissolved', :, :].shape # first two + all others
  ---------------------------------------------------------------------------
  KeyError                                  Traceback (most recent call last)
  &lt;ipython-input-62-1fb577ec32fa&gt; in &lt;module&gt;()
  ----&gt; 1 metals.ix['BI', 'Arsenic, Dissolved', :, :].shape                              
  # traceback spaghetti snipped
  KeyError: 'no item named Arsenic, Dissolved'
  
  In [62]: metals.ix['BI', 'Arsenic, Dissolved', :, 1.0].shape # also fails
  </code></pre>
  
  <p>It took me a long time to realize that what I had been trying to achieve with <code>In [61]</code> was possible with <code>In [60]</code>. Why does the <code>ix</code> method behave like this? What I'm really trying to get at is the scenario at <code>In [62]</code>. </p>
  
  <p>My guess is that I need to redefine the index hierarchy, but I'm curious if there's an easier way.</p>
  
  <p>Thanks.</p>