@@ -22,6 +22,7 @@ The pandas I/O API is a set of top level ``reader`` functions accessed like
22
22
text;Fixed-Width Text File;:ref: `read_fwf<io.fwf_reader> `
23
23
text;`JSON <https://www.json.org/>`__;:ref: `read_json<io.json_reader> `;:ref: `to_json<io.json_writer> `
24
24
text;`HTML <https://en.wikipedia.org/wiki/HTML>`__;:ref: `read_html<io.read_html> `;:ref: `to_html<io.html> `
25
+ text;`LaTeX <https://en.wikipedia.org/wiki/LaTeX>`__;;:ref: `Styler.to_latex<io.latex> `
25
26
text;`XML <https://www.w3.org/standards/xml/core>`__;:ref: `read_xml<io.read_xml> `;:ref: `to_xml<io.xml> `
26
27
text; Local clipboard;:ref: `read_clipboard<io.clipboard> `;:ref: `to_clipboard<io.clipboard> `
27
28
binary;`MS Excel <https://en.wikipedia.org/wiki/Microsoft_Excel>`__;:ref: `read_excel<io.excel_reader> `;:ref: `to_excel<io.excel_writer> `
@@ -2830,7 +2831,42 @@ parse HTML tables in the top-level pandas io function ``read_html``.
2830
2831
.. |lxml | replace :: **lxml **
2831
2832
.. _lxml : https://lxml.de
2832
2833
2834
+ .. _io.latex :
2833
2835
2836
+ LaTeX
2837
+ -----
2838
+
2839
+ .. versionadded :: 1.3.0
2840
+
2841
+ Currently there are no methods to read from LaTeX, only output methods.
2842
+
2843
+ Writing to LaTeX files
2844
+ ''''''''''''''''''''''
2845
+
2846
+ .. note ::
2847
+
2848
+ DataFrame *and * Styler objects currently have a ``to_latex `` method. We recommend
2849
+ using the `Styler.to_latex() <../reference/api/pandas.io.formats.style.Styler.to_latex.rst >`__ method
2850
+ over `DataFrame.to_latex() <../reference/api/pandas.DataFrame.to_latex.rst >`__ due to the former's greater flexibility with
2851
+ conditional styling, and the latter's possible future deprecation.
2852
+
2853
+ Review the documentation for `Styler.to_latex <../reference/api/pandas.io.formats.style.Styler.to_latex.rst >`__,
2854
+ which gives examples of conditional styling and explains the operation of its keyword
2855
+ arguments.
2856
+
2857
+ For simple application the following pattern is sufficient.
2858
+
2859
+ .. ipython :: python
2860
+
2861
+ df = pd.DataFrame([[1 , 2 ], [3 , 4 ]], index = [" a" , " b" ], columns = [" c" , " d" ])
2862
+ print (df.style.to_latex())
2863
+
2864
+ To format values before output, chain the `Styler.format <../reference/api/pandas.io.formats.style.Styler.format.rst >`__
2865
+ method.
2866
+
2867
+ .. ipython :: python
2868
+
2869
+ print (df.style.format(" € {} " ).to_latex())
2834
2870
2835
2871
XML
2836
2872
---
0 commit comments