Commit 7a4c467
committed
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.1 parent e800fe1 commit 7a4c467
File tree
3 files changed
+27
-2
lines changed- doc/source
- pandas
- core
- tests
3 files changed
+27
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | | - | |
| 432 | + | |
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
| 535 | + | |
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2083 | 2083 | | |
2084 | 2084 | | |
2085 | 2085 | | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
2086 | 2111 | | |
2087 | 2112 | | |
2088 | 2113 | | |
| |||
0 commit comments