@@ -468,7 +468,7 @@ def to_latex(
468
468
column_format : str | None = None ,
469
469
position : str | None = None ,
470
470
position_float : str | None = None ,
471
- hrules : bool = False ,
471
+ hrules : bool | None = None ,
472
472
label : str | None = None ,
473
473
caption : str | tuple | None = None ,
474
474
sparse_index : bool | None = None ,
@@ -488,7 +488,7 @@ def to_latex(
488
488
Parameters
489
489
----------
490
490
buf : str, Path, or StringIO-like, optional, default None
491
- Buffer to write to. If `` None` `, the output is returned as a string.
491
+ Buffer to write to. If `None`, the output is returned as a string.
492
492
column_format : str, optional
493
493
The LaTeX column specification placed in location:
494
494
@@ -509,9 +509,12 @@ def to_latex(
509
509
\\<position_float>
510
510
511
511
Cannot be used if ``environment`` is "longtable".
512
- hrules : bool, default False
512
+ hrules : bool
513
513
Set to `True` to add \\toprule, \\midrule and \\bottomrule from the
514
514
{booktabs} LaTeX package.
515
+ Defaults to ``pandas.options.styler.latex.hrules``, which is `False`.
516
+
517
+ .. versionchanged:: 1.4.0
515
518
label : str, optional
516
519
The LaTeX label included as: \\label{<label>}.
517
520
This is used with \\ref{<label>} in the main .tex file.
@@ -522,16 +525,17 @@ def to_latex(
522
525
sparse_index : bool, optional
523
526
Whether to sparsify the display of a hierarchical index. Setting to False
524
527
will display each explicit level element in a hierarchical key for each row.
525
- Defaults to ``pandas.options.styler.sparse.index`` value .
528
+ Defaults to ``pandas.options.styler.sparse.index``, which is `True` .
526
529
sparse_columns : bool, optional
527
530
Whether to sparsify the display of a hierarchical index. Setting to False
528
531
will display each explicit level element in a hierarchical key for each
529
- column. Defaults to ``pandas.options.styler.sparse.columns`` value.
532
+ column. Defaults to ``pandas.options.styler.sparse.columns``, which
533
+ is `True`.
530
534
multirow_align : {"c", "t", "b", "naive"}, optional
531
535
If sparsifying hierarchical MultiIndexes whether to align text centrally,
532
536
at the top or bottom using the multirow package. If not given defaults to
533
- ``pandas.options.styler.latex.multirow_align``. If "naive" is given renders
534
- without multirow.
537
+ ``pandas.options.styler.latex.multirow_align``, which is `"c"`.
538
+ If "naive" is given renders without multirow.
535
539
536
540
.. versionchanged:: 1.4.0
537
541
multicol_align : {"r", "c", "l", "naive-l", "naive-r"}, optional
@@ -550,12 +554,12 @@ def to_latex(
550
554
If given, the environment that will replace 'table' in ``\\begin{table}``.
551
555
If 'longtable' is specified then a more suitable template is
552
556
rendered. If not given defaults to
553
- ``pandas.options.styler.latex.environment``.
557
+ ``pandas.options.styler.latex.environment``, which is `None` .
554
558
555
559
.. versionadded:: 1.4.0
556
560
encoding : str, optional
557
561
Character encoding setting. Defaults
558
- to ``pandas.options.styler.render.encoding`` value of "utf-8".
562
+ to ``pandas.options.styler.render.encoding``, which is "utf-8".
559
563
convert_css : bool, default False
560
564
Convert simple cell-styles from CSS to LaTeX format. Any CSS not found in
561
565
conversion table is dropped. A style can be forced by adding option
@@ -844,6 +848,7 @@ def to_latex(
844
848
overwrite = False ,
845
849
)
846
850
851
+ hrules = get_option ("styler.latex.hrules" ) if hrules is None else hrules
847
852
if hrules :
848
853
obj .set_table_styles (
849
854
[
0 commit comments