Display & Export
title(title=None, subtitle=None)
Add a title and optional subtitle above the table.
titlestr | None, defaultNone— Main title textsubtitlestr | None, defaultNone— Subtitle text (smaller, below title)
df.style().title("Big Tech Financials", subtitle="FY 2023").show()
| Company | Revenue | Profit | Growth | Employees_k |
|---|---|---|---|---|
| Apple | 383.3 | 97.0 | 7.8 | 161 |
| Microsoft | 211.9 | 72.4 | 6.9 | 221 |
| 307.4 | 73.8 | 8.7 | 182 | |
| Amazon | 574.8 | 30.4 | 11.8 | 1541 |
| Meta | 134.9 | 39.1 | 16.4 | 67 |
footnote(text)
Add footnote text below the table (smaller font, muted colour).
textstr— Footnote text
df.style().footnote("Source: Company annual reports. Revenue in $B.").show()
| Company | Revenue | Profit | Growth | Employees_k |
|---|---|---|---|---|
| Apple | 383.3 | 97.0 | 7.8 | 161 |
| Microsoft | 211.9 | 72.4 | 6.9 | 221 |
| 307.4 | 73.8 | 8.7 | 182 | |
| Amazon | 574.8 | 30.4 | 11.8 | 1541 |
| Meta | 134.9 | 39.1 | 16.4 | 67 |
caption(text)
Add a caption above the table following scientific convention (e.g. "Table 1: ...").
Use with fashion_scientific() for publication-style tables.
textstr— Caption text
df.style().caption("Table 1: Summary statistics").fashion_scientific().show()
| Company | Revenue | Profit | Growth | Employees_k |
|---|---|---|---|---|
| Apple | 383.3 | 97.0 | 7.8 | 161 |
| Microsoft | 211.9 | 72.4 | 6.9 | 221 |
| 307.4 | 73.8 | 8.7 | 182 | |
| Amazon | 574.8 | 30.4 | 11.8 | 1541 |
| Meta | 134.9 | 39.1 | 16.4 | 67 |
show_idx()
Show the row index column (hidden by default).
No parameters.
df.style().show_idx().show()
| Company | Revenue | Profit | Growth | Employees_k | |
|---|---|---|---|---|---|
| 0 | Apple | 383.3 | 97.0 | 7.8 | 161 |
| 1 | Microsoft | 211.9 | 72.4 | 6.9 | 221 |
| 2 | 307.4 | 73.8 | 8.7 | 182 | |
| 3 | Amazon | 574.8 | 30.4 | 11.8 | 1541 |
| 4 | Meta | 134.9 | 39.1 | 16.4 | 67 |
hide_columns()
Hide the column header row. The data remains fully visible; only the <thead> row is suppressed.
No parameters.
df.style().hide_columns().fashion_minimal().show()
| Apple | 383.3 | 97.0 | 7.8 | 161 |
| Microsoft | 211.9 | 72.4 | 6.9 | 221 |
| 307.4 | 73.8 | 8.7 | 182 | |
| Amazon | 574.8 | 30.4 | 11.8 | 1541 |
| Meta | 134.9 | 39.1 | 16.4 | 67 |
show_info(name=None)
Display DataFrame metadata (name, shape) above the table.
namestr | None, defaultNone— Optional dataset name to display
df.style().show_info(name="finance").show()
shape: (5, 5)
| Company | Revenue | Profit | Growth | Employees_k |
|---|---|---|---|---|
| Apple | 383.3 | 97.0 | 7.8 | 161 |
| Microsoft | 211.9 | 72.4 | 6.9 | 221 |
| 307.4 | 73.8 | 8.7 | 182 | |
| Amazon | 574.8 | 30.4 | 11.8 | 1541 |
| Meta | 134.9 | 39.1 | 16.4 | 67 |
to_html(path=None) -> str
Generate the styled HTML table as a string, or save to a file.
pathstr | None, defaultNone— If provided, writes HTML to this file path
Returns: HTML string.
# Get HTML string
html = df.style().gradient("Revenue").to_html()
# Save to file
df.style().gradient("Revenue").to_html("output/report.html")
to_latex(caption=None, label=None) -> str
Export the table as a LaTeX tabular environment using booktabs formatting.
captionstr | None, defaultNone— Table caption (placed in\caption{})labelstr | None, defaultNone— Table label for cross-referencing (\label{})
Returns: LaTeX string.
latex = df.style().fashion_scientific().to_latex(
caption="Big Tech financials",
label="tab:finance"
)
print(latex)
Note: Cell background colours are not exported to LaTeX. Only table structure and text formatting are preserved.
% Required packages:
% \usepackage{booktabs}
% \usepackage{caption}
\begin{table}[ht]
\centering
\caption{Big Tech financials}
\label{tab:finance}
\begin{tabular}{lrrrr}
\toprule
\textbf{Company} & \textbf{Revenue} & \textbf{Profit} & \textbf{Growth} & \textbf{Employees\_k} \\
\midrule
Apple & 383.3 & 97.0 & 7.8 & 161 \\
Microsoft & 211.9 & 72.4 & 6.9 & 221 \\
Google & 307.4 & 73.8 & 8.7 & 182 \\
Amazon & 574.8 & 30.4 & 11.8 & 1541 \\
Meta & 134.9 & 39.1 & 16.4 & 67 \\
\bottomrule
\end{tabular}
\end{table}
show() -> None
Open the rendered HTML table in the system default browser. Alias for view_html() with no arguments.
No parameters.
df.style().gradient("Revenue").show()
Platform behavior
| Platform | Preview file location | Auto-deleted |
|---|---|---|
| macOS | System temp directory | On reboot |
| Windows | System temp directory | On reboot |
| Linux | Home directory (~/polarise_preview_<timestamp>.html) |
Never — delete manually |
On Linux, Snap-packaged Firefox (Ubuntu 22.04+) cannot access /tmp/, so polarise writes to your home directory instead. Files accumulate until you delete them.
Jupyter users: You don't need
.show(). polarise implements_repr_html_(), so styled tables render automatically when aStyleris the last expression in a cell.
view_html(browser=None) -> str
Open the rendered HTML table in a browser. Returns the path to the temporary HTML file.
browserstr | None, defaultNone— Browser to use (macOS only):"Chrome","Safari", or"Orion". On other platforms the system default is always used.
Returns: Path to the temporary HTML file.
df.style().gradient("Revenue").view_html() # default browser
df.style().gradient("Revenue").view_html("Chrome") # Chrome (macOS only)