Skip to content

REF: type change escape in Styler.format to str to allow "html" and "latex" #41619

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

Merged
merged 16 commits into from
May 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs
  • Loading branch information
attack68 committed May 26, 2021
commit 4a7e4e3d187d727223cc01fe5d5f50fd88e1eafb
11 changes: 11 additions & 0 deletions pandas/io/formats/style_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,17 @@ def format(
<td .. ><a href="a.com/&#34;A&amp;B&#34;">&#34;A&amp;B&#34;</a></td>
<td .. >NA</td>
...

Using a ``formatter`` with LaTeX ``escape``.

>>> df = pd.DataFrame([["123"], ["~ ^"], ["$%#"]])
>>> s = df.style.format("\\textbf{{{}}}", escape="latex").to_latex()
\begin{tabular}{ll}
{} & {0} \\
0 & \textbf{123} \\
1 & \textbf{\textasciitilde \space \textasciicircum } \\
2 & \textbf{\$\%\#} \\
\end{tabular}
"""
if all(
(
Expand Down