How do I select a particular column from a DataFrame when there are multiple levels of naming?
>>> x = pd.DataFrame({'instance':['first','first','first'],'foo':['a','b','c'],'bar':rand(3)})
>>> x = x.set_index(['instance','foo']).transpose()
>>> x.columns
MultiIndex
[(u'first', u'a'), (u'first', u'b'), (u'first', u'c')]
>>> x
instance first
foo a b c
bar 0.102885 0.937838 0.907467
(Note: this question is asked in the comments to this SO question and there is an answer also in the comments. Thought it'd be good to have it as a question in its own right.)