Skip to content
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

REF: Use Styler implementation for DataFrame.to_latex #47970

Merged
merged 28 commits into from Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
02d7d0c
Base implementation
attack68 Aug 3, 2022
0c12f3a
Base implementation
attack68 Aug 3, 2022
d644065
test fix up
attack68 Aug 3, 2022
9dcd254
test fix up
attack68 Aug 3, 2022
cd05038
test fix up
attack68 Aug 4, 2022
c625610
doc change
attack68 Aug 4, 2022
493b884
doc change
attack68 Aug 4, 2022
41fa426
doc change
attack68 Aug 4, 2022
2d5c419
mypy fixes
attack68 Aug 5, 2022
c9c61c3
ivanov doc comment
attack68 Aug 9, 2022
ab6d3ec
ivanov doc comment
attack68 Aug 9, 2022
b913583
rhshadrach reduction
attack68 Aug 11, 2022
801bf42
Merge branch 'main' into to_latex_styler_implement
attack68 Nov 18, 2022
c803b73
change text from 1.5.0 to 2.0.0
attack68 Nov 18, 2022
df0b334
remove argument col_space and add whatsnew
attack68 Nov 18, 2022
f4e4bf7
Merge remote-tracking branch 'upstream/main' into to_latex_styler_imp…
attack68 Dec 7, 2022
9774341
mroeschke requests
attack68 Dec 7, 2022
10b5ec9
mroeschke requests
attack68 Dec 7, 2022
2c42a4e
pylint fix
attack68 Dec 8, 2022
3c2f964
Merge remote-tracking branch 'upstream/main' into to_latex_styler_imp…
attack68 Jan 5, 2023
0b4144a
Whats new text improvements and description added
attack68 Jan 5, 2023
fae1b3f
Update doc/source/whatsnew/v2.0.0.rst
attack68 Jan 13, 2023
9c7d780
Update doc/source/whatsnew/v2.0.0.rst
attack68 Jan 13, 2023
c0bdc6a
remove trailing whitespace
attack68 Jan 16, 2023
c740279
remove trailing whitespace
attack68 Jan 16, 2023
9b6bba8
Merge remote-tracking branch 'upstream/main' into to_latex_styler_imp…
attack68 Jan 17, 2023
6b314cd
Whats new linting fixes
attack68 Jan 17, 2023
d6333cb
mroeschke requests
attack68 Jan 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions doc/source/whatsnew/v2.0.0.rst
Expand Up @@ -452,6 +452,37 @@ Now, the axes return an empty :class:`RangeIndex`.
pd.Series().index
pd.DataFrame().axes

.. _whatsnew_200.api_breaking.to_latex:

DataFrame to LaTeX has a new render engine
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The existing :meth:`DataFrame.to_latex` has been restructured to utilise the
extended implementation previously available under :meth:`.Styler.to_latex`.
The arguments signature is similar, albeit ``col_space`` has been removed since
it is ignored by LaTeX engines. This render engine also requires ``jinja2`` as a
dependency which needs to be installed, since rendering is based upon jinja2 templates.

The pandas options below are no longer used and will be removed in future releases.
The alternative options giving similar functionality are indicated below:

- ``display.latex.escape``: replaced with ``styler.format.escape``,
- ``display.latex.longtable``: replaced with ``styler.latex.environment``,
- ``display.latex.multicolumn``, ``display.latex.multicolumn_format`` and
``display.latex.multirow``: replaced with ``styler.sparse.rows``,
``styler.sparse.columns``, ``styler.latex.multirow_align`` and
``styler.latex.multicol_align``,
- ``display.latex.repr``: replaced with ``styler.render.repr``,
- ``display.max_rows`` and ``display.max_columns``: replace with
``styler.render.max_rows``, ``styler.render.max_columns`` and
``styler.render.max_elements``.

Note that the behaviour of ``_repr_latex_`` is also changed. Previously
setting ``display.latex.repr`` would generate LaTeX only when using nbconvert for a
JupyterNotebook, and not when the user is running the notebook. Now the
``styler.render.repr`` option allows control of the specific output
within JupyterNotebooks for operations (not just on nbconvert). See :issue:`39911`.

.. _whatsnew_200.api_breaking.deps:

Increased minimum versions for dependencies
Expand Down Expand Up @@ -617,6 +648,7 @@ Removal of prior version deprecations/changes
- Removed deprecated :meth:`.Styler.set_na_rep` and :meth:`.Styler.set_precision` (:issue:`49397`)
- Removed deprecated :meth:`.Styler.where` (:issue:`49397`)
- Removed deprecated :meth:`.Styler.render` (:issue:`49397`)
- Removed deprecated argument ``col_space`` in :meth:`DataFrame.to_latex` (:issue:`47970`)
- Removed deprecated argument ``null_color`` in :meth:`.Styler.highlight_null` (:issue:`49397`)
- Removed deprecated argument ``check_less_precise`` in :meth:`.testing.assert_frame_equal`, :meth:`.testing.assert_extension_array_equal`, :meth:`.testing.assert_series_equal`, :meth:`.testing.assert_index_equal` (:issue:`30562`)
- Removed deprecated ``null_counts`` argument in :meth:`DataFrame.info`. Use ``show_counts`` instead (:issue:`37999`)
Expand Down Expand Up @@ -791,6 +823,7 @@ Removal of prior version deprecations/changes
- Changed behavior of comparison of ``NaT`` with a ``datetime.date`` object; these now raise on inequality comparisons (:issue:`39196`)
- Enforced deprecation of silently dropping columns that raised a ``TypeError`` in :class:`Series.transform` and :class:`DataFrame.transform` when used with a list or dictionary (:issue:`43740`)
- Changed behavior of :meth:`DataFrame.apply` with list-like so that any partial failure will raise an error (:issue:`43740`)
- Changed behaviour of :meth:`DataFrame.to_latex` to now use the Styler implementation via :meth:`.Styler.to_latex` (:issue:`47970`)
- Changed behavior of :meth:`Series.__setitem__` with an integer key and a :class:`Float64Index` when the key is not present in the index; previously we treated the key as positional (behaving like ``series.iloc[key] = val``), now we treat it is a label (behaving like ``series.loc[key] = val``), consistent with :meth:`Series.__getitem__`` behavior (:issue:`33469`)
- Removed ``na_sentinel`` argument from :func:`factorize`, :meth:`.Index.factorize`, and :meth:`.ExtensionArray.factorize` (:issue:`47157`)
- Changed behavior of :meth:`Series.diff` and :meth:`DataFrame.diff` with :class:`ExtensionDtype` dtypes whose arrays do not implement ``diff``, these now raise ``TypeError`` rather than casting to numpy (:issue:`31025`)
Expand Down