@@ -3500,14 +3500,17 @@ def _to_latex_via_styler(
3500
3500
):
3501
3501
"""
3502
3502
Render object to a LaTeX tabular, longtable, or nested table.
3503
+
3503
3504
Uses the ``Styler`` implementation with the following, ordered, method chaining:
3505
+
3504
3506
.. code-block:: python
3505
3507
styler = Styler(DataFrame)
3506
3508
styler.hide(**hide)
3507
3509
styler.relabel_index(**relabel_index)
3508
3510
styler.format(**format)
3509
3511
styler.format_index(**format_index)
3510
3512
styler.to_latex(buf=buf, **render_kwargs)
3513
+
3511
3514
Parameters
3512
3515
----------
3513
3516
buf : str, Path or StringIO-like, optional, default None
@@ -3526,35 +3529,11 @@ def _to_latex_via_styler(
3526
3529
list will call the method numerous times.
3527
3530
render_kwargs : dict
3528
3531
Keyword args to pass to the method call of ``Styler.to_latex``.
3532
+
3529
3533
Returns
3530
3534
-------
3531
3535
str or None
3532
3536
If buf is None, returns the result as a string. Otherwise returns None.
3533
- See Also
3534
- --------
3535
- Styler.to_latex : Render a DataFrame to LaTeX with conditional formatting.
3536
- DataFrame.to_string : Render a DataFrame to a console-friendly
3537
- tabular output.
3538
- DataFrame.to_html : Render a DataFrame as an HTML table.
3539
- Examples
3540
- --------
3541
- Convert a general DataFrame to LaTeX with formatting:
3542
- >>> df = pd.DataFrame(dict(name=['Raphael', 'Donatello'],
3543
- ... age=[26, 45],
3544
- ... height=[181.23, 177.65]))
3545
- >>> print(df.to_latex(hide={"axis": "index"},
3546
- ... format={"formatter": {"name": str.upper},
3547
- ... "precision": 1},
3548
- ... render_kwargs={"hrules": True}
3549
- ... ) # doctest: +SKIP
3550
- \b egin{{tabular}}{{lrr}}
3551
- \t oprule
3552
- name & age & height \\
3553
- \\ midrule
3554
- RAPHAEL & 26 & 181.2 \\
3555
- DONATELLO & 45 & 177.7 \\
3556
- \b ottomrule
3557
- \\ end{{tabular}}
3558
3537
"""
3559
3538
from pandas .io .formats .style import Styler
3560
3539
0 commit comments