Initializing playground…
← Back to roadmap

DataFrame Styler

dataFrameStyle · highlightMax · backgroundGradient · barChart · toHtml · toLatex · mirrors pandas.DataFrame.style

Overview

The Styler class provides a fluent API for applying CSS styles to a DataFrame and rendering the result as styled HTML — directly analogous to pandas.DataFrame.style (the pandas.io.formats.style.Styler class).

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

Import

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

Factory function

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.format(formatter, subset?, naRep?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.formatIndex(formatter)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.setPrecision(n)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.setNaRep(str)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.apply(fn, axis?, subset?)

Apply a column-wise (axis=0) or row-wise (axis=1) function. The function receives an array of values and must return an array of CSS strings of the same length.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.applymap(fn, subset?) / .map(fn, subset?)

Apply an element-wise function (pandas ≥ 2.1 renamed applymapmap; both are supported).

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.setProperties(props, subset?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.highlightMax(options?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.highlightMin(options?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.highlightNull(color?, subset?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.highlightBetween(options?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.backgroundGradient(options?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.textGradient(options?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.barChart(options?)

Renders inline bar charts using CSS linear-gradient.

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.setCaption(text)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.setTableStyles(styles)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.setTableAttributes(attrs)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.hide(axis?, subset?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.toHtml(uuid?) / .render(uuid?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.toLatex(environment?, hrules?)

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.exportStyles()

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent

.clearStyles()

TypeScript
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent