Skip to content

ENH: expand multicol_align and multirow_align Styler.to_latex #43471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
attack68 opened this issue Sep 9, 2021 · 0 comments · Fixed by #43656
Closed

ENH: expand multicol_align and multirow_align Styler.to_latex #43471

attack68 opened this issue Sep 9, 2021 · 0 comments · Fixed by #43656
Labels
Enhancement IO LaTeX to_latex Styler conditional formatting using DataFrame.style

Comments

@attack68
Copy link
Contributor

attack68 commented Sep 9, 2021

Currently styler only allows multicol_align in {"r", "l", "c", "naive-l", "naive-r"}

Simple pipe characters around multicol_alignment allow dividers to be drawn, e.g. |r or |r| or r| etc..

\begin{tabular}{lllrrrrrr}
\toprule
{} & {} & {} & \multicolumn{3}{|r|}{1} & \multicolumn{3}{|r|}{2} \\ 
{} & {} & {} & \multicolumn{2}{r|}{a} & {b} & \multicolumn{2}{|l}{a} & {b} \\
{} & {} & {} & {0} & {0} & {0} & {0} & {0} & {0} \\
\midrule
\multirow[t]{3}{*}{1} & \multirow[t]{2}{*}{a} & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\
 &  & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\
 & b & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\ \cline{1-3}
\multirow[t]{3}{*}{2} & \multirow[t]{2}{*}{a} & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\ 
 &  & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\ 
 & b & 0 & -1 & -1 & -1 & -1 & -1 & -1 \\
 \bottomrule
\end{tabular}

Screen Shot 2021-09-09 at 08 44 16

Also note the cline (this one might be harder to implement)

@attack68 attack68 added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member Styler conditional formatting using DataFrame.style IO LaTeX to_latex and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO LaTeX to_latex Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant