title: Pandas: Use multiple columns of a dataframe as index of another
body: <p>I've got a large dataframe with my data in it, and another dataframe of the same first dimension that contains metadata about each point in time (e.g., what trial number it was, what trial type it was).</p>
  
  <p>What I want to do is slice the large dataframe using the values of the "metadataframe".  I want to keep these separate (rather than storing the metadataframe as a multi-index of the larger one).</p>
  
  <p>Right now, I am trying to do something like this:</p>
  
  <pre><code>def my_func(container):
     container.big_df.set_index(container.meta_df[['col1', 'col2']])
     container.big_df.loc['col1val', 'col2val'].plot()
  </code></pre>
  
  <p>However, this returns the following error:</p>
  
  <pre><code>ValueError: Must pass DataFrame with boolean values only
  </code></pre>
  
  <p>Note that this works fine if I only pass a single column to set_index.</p>
  
  <p>Can anyone figure out what's going wrong here?  Alternatively, can someone tell me that I'm doing this in a totally stupid and hacky way, and that there's a much better way to go about it?  :)</p>
  
  <p><strong>MY SOLUTION</strong></p>
  
  <p>Thanks for the ideas.  I played around with the indexing a little bit, and this seems to be the easiest / fastest.  I didn't like having to strip the index of its name, and transposing the values etc. seemed cumbersome.  I realized something interesting (and probably worth easily fixing):</p>
  
  <pre><code>dfa.set_index(dfb[['col1', 'col2']]) 
  </code></pre>
  
  <p>doesn't work, but</p>
  
  <pre><code>dfa.set_index([dfb.col1, dfb.col2])
  </code></pre>
  
  <p>does.</p>
  
  <p>So, you can basically turn dfb into a list of columns, making set_index work, by the following convention:</p>
  
  <pre><code>dfa.set_index([dfb[col] for col in ['col1', 'col2']])
  </code></pre>