@@ -620,7 +620,7 @@ def to_latex(
620620 position : str | None = ...,
621621 position_float : str | None = ...,
622622 hrules : bool | None = ...,
623- clines : str | None = ...,
623+ clines : str | tuple | None = ...,
624624 label : str | None = ...,
625625 caption : str | tuple | None = ...,
626626 sparse_index : bool | None = ...,
@@ -642,7 +642,7 @@ def to_latex(
642642 position : str | None = ...,
643643 position_float : str | None = ...,
644644 hrules : bool | None = ...,
645- clines : str | None = ...,
645+ clines : str | tuple | None = ...,
646646 label : str | None = ...,
647647 caption : str | tuple | None = ...,
648648 sparse_index : bool | None = ...,
@@ -663,7 +663,7 @@ def to_latex(
663663 position : str | None = None ,
664664 position_float : str | None = None ,
665665 hrules : bool | None = None ,
666- clines : str | None = None ,
666+ clines : str | tuple | None = None ,
667667 label : str | None = None ,
668668 caption : str | tuple | None = None ,
669669 sparse_index : bool | None = None ,
@@ -712,32 +712,36 @@ def to_latex(
712712 Defaults to ``pandas.options.styler.latex.hrules``, which is `False`.
713713
714714 .. versionchanged:: 1.4.0
715- clines : str, optional
715+ clines : str, tuple, optional
716716 Use to control adding \\cline commands for the index labels separation.
717- Possible values are:
717+ If `None`, then no cline commands are added (default).
718+
719+ If a tuple is passed, the following elements are recognised:
720+ - `"rule-data"`: if present, clines are added for both the index and data.
721+ Otherwise, they are only drawn for the index.
722+ - `"skip-last"`: if present, the last index level is omitted when deciding
723+ where to add clines. Otherwise, all index levels are used.
724+ - `"include-hidden"`: if present, hidden index levels are included when
725+ deciding where to add clines. Otherwise, only visible index levels are
726+ used.
727+
728+ If a str is passed, possible values are:
718729
719730 - `None`: no cline commands are added (default).
720731 - `"all;data"`: a cline is added for every visible index value extending
721732 the width of the table, including data entries.
722733 - `"all;index"`: as above with lines extending only the width of the
723734 index entries.
724- - `"all-invisible;data"`: a cline is added for every index value,
725- including hidden indexes, extending the full width of the table,
726- including data entries.
727- - `"all-invisible;index"`: as above with lines extending only the width
728- of the index entries.
729735 - `"skip-last;data"`: a cline is added for each visible index value except
730736 the last level (which is never sparsified), extending the widtn of the
731737 table.
732738 - `"skip-last;index"`: as above with lines extending only the width of the
733739 index entries.
734- - `"skip-last-invisible;data"`: a cline is added for each index value,
735- including hidden index levels, but excluding the last (which is never
736- sparsified), extending the width of the table.
737- - `"skip-last-invisible;index"`: as above with lines extending only the
738- width of the index entries.
739740
740741 .. versionchanged:: 3.0.0
742+ .. deprecated:: 3.0.0
743+ Passing a str is deprecated and will be removed in a future version,
744+ please use a tuple instead.
741745 label : str, optional
742746 The LaTeX label included as: \\label{<label>}.
743747 This is used with \\ref{<label>} in the main .tex file.
@@ -1090,7 +1094,7 @@ def to_latex(
10901094
10911095 >>> styler.to_latex(
10921096 ... caption="Selected stock correlation and simple statistics.",
1093- ... clines="skip-last; data",
1097+ ... clines=( "skip-last", "across- data") ,
10941098 ... convert_css=True,
10951099 ... position_float="centering",
10961100 ... multicol_align="|c|",
0 commit comments