DEPR: `LatexFormatter` in `DataFrame.to_latex` in favour of `Styler`
See original GitHub issueThe tracker of items needed to do before deprecating DataFrame.to_latex()
.
- acceptance of the
jinja2
requirement for LaTeX output, sinceStyler
requiresjinja2
: this is blocker. - make Styler functional for all DataFrames (i.e. including non-unique columns, indexes) (#41269).
- enhance for
longtable
keyword or other environments (#41866). - enhance for
caption
to allow short and long captions, and allow top/bottom caption placement. (#41659) - enhance with ability to style indexes/column headers with styles (e.g bold rows). (#41993)
- enhance with an escape option for LaTeX characters. (#41619)
-
enhancenot necessary.hide_columns
with.show_columns
alternative (optional) - enhance
.hide_columns
and.hide_index
to have dual function to hide the entire array, or specific items (#41266) - make styler reactive to separate sparse columns and index separately (#41512)
- acceptance of removal of specific kwargs and all formatting keyword args (see below).
-
validation fornot necessarycolumn_format
to pass tests or just rely on docs/duck typing? - validation for
caption
to pass tests (#43368) or just remove the validation in favour of duck typing? - ability to format index with a formatter #43101
- separate
siunitx
for encapsulating headers in curly braces only when necessary #43397 - index names removal #43346
- Optionally use multirow / multicol or just blank out cells. #43369 #43382
- fix bug: label doesnt render if a caption is not given (table and longtable) #43399
Removed Keyword Args
col_space
: removed since Styler.to_latex()
does not necessarily produce display values of equal length, (this is a console display only arg)
sparsify
: replaced by alternative kwargs sparse_index
and sparse_columns
multicolumn
, multicolumn_format
, multirow
: replaced by alternative kwargs multirow_align
multicol_align
formatters
float_format
: replaced by the superior df.style.format(...)
args
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
pandas.io.formats.style.Styler.to_latex
Convert simple cell-styles from CSS to LaTeX format. Any CSS not found in conversion table is dropped. A style can be forced by...
Read more >Pandas DataFrame to Latex Formatter Functions
I am trying to export a DataFrame to Latex using a formatter function to specify the format of the columns. So far I...
Read more >Pandas DataFrame to LaTeX table - LaTeX course - YouTube
I am going to show you how you can export a Pandas Data Frame to a LaTeX table. I will also show you...
Read more >How to Style Pandas DataFrames Like a Pro
In Excel, you can leverage one-click coloring or conditional formatting to make your tables stand out. In Pandas, well, it's a bit trickier....
Read more >Pandas Dataframe to Latex - Calmcode
Pandas to Latex logo ... print(df.head(10).to_latex(index=False)) ... If you've savvy with Latex, you can even expand the syntax by leveraging styles.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
we can straight depreciate DataFrame.to_latex w/o changing the implementation at all
sure if u can totally do everything in styler.to_latex that would be great but it’s likely not a big deal to implement things later / drop features if needed
Don’t deprecations by definition warn of failing backwards compatibility in a future version? For 1.x is it enough to just warn that
DataFrame
methods will not be developed in future and will eventually be removed (or refactored), albeit they remain in place, as is, for those versions?I’m trying hard to try and avoid the case where the existing keyword signature of
DataFrame.to_html
andDataFrame.to_latex
must be maintained/replicated or squeezed intoStylers
format, for the reason that some of them are bad arguments, and subjectively the new format is decoupled (more maintainable) and more flexible, and consistent from format to format (html, excel, latex).