title: MultiIndexing rows vs. columns in pandas DataFrame
body: <p>I am working with multiindexing dataframe in pandas and am wondering whether I should multiindex the rows or the columns. </p>
  
  <p>My data looks something like this:
  <img src="https://i.stack.imgur.com/XdJUF.png" alt="DataTable"></p>
  
  <p>Code:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  arrays = pd.tools.util.cartesian_product([['condition1', 'condition2'], 
                                            ['patient1', 'patient2'],
                                            ['measure1', 'measure2', 'measure3']])
  colidxs = pd.MultiIndex.from_arrays(arrays, 
                                      names=['condition', 'patient', 'measure'])
  rowidxs = pd.Index([0,1,2,3], name='time')
  data = pd.DataFrame(np.random.randn(len(rowidxs), len(colidxs)), 
                      index=rowidxs, columns=colidxs)
  </code></pre>
  
  <p>Here I choose to multiindex the column, with the rationale that pandas dataframe consists of series, and my data ultimately is a bunch of time series (hence row-indexed by time here). </p>
  
  <p>I have this question because it seems there is some asymmetry between rows and columns for multiindexing. For example, in <a href="http://pandas.pydata.org/pandas-docs/stable/indexing.html#multiindex-query-syntax" rel="noreferrer">this</a> document webpage it shows how <code>query</code> works for row-multiindexed dataframe, but if the dataframe is column-multiindexed then the command in the document has to be replaced by something like <code>df.T.query('color == "red"').T</code>. </p>
  
  <p>My question might seem a bit silly, but I'd like to see if there is any difference in convenience between multiindexing rows vs. columns for dataframes (such as the <code>query</code> case above).</p>
  
  <p>Thanks.</p>