pydata/pandas — pull request #7982 by shoyer (2014-08-10 20:38:49+00:00)
Title: Fix DataFrame.to_latex() with MultiIndex columns

Currently, the positioning of \midrule is determined by the number of index
levels, not columns levels:

>>> print pd.DataFrame({('x', 'y'): ['a']}).to_latex()
\begin{tabular}{ll}
\toprule
{} & x \\
\midrule
{} & y \\
0 & a \\
\bottomrule
\end{tabular}

The fix is simple: use the number of column levels instead of the number
of index levels.