Style

Styler objects are returned by pandas.DataFrame.style.

Styler Constructor

Styler(data[, precision, table_styles, …]) Helps style a DataFrame or Series according to the data with HTML and CSS.
Styler.from_custom_template(searchpath, name) Factory function for creating a subclass of Styler with a custom template and Jinja environment.

Style Application

Styler.apply(func[, axis, subset]) Apply a function column-wise, row-wise, or table-wise, updating the HTML representation with the result.
Styler.applymap(func[, subset]) Apply a function elementwise, updating the HTML representation with the result.
Styler.where(cond, value[, other, subset]) Apply a function elementwise, updating the HTML representation with a style which is selected in accordance with the return value of a function.
Styler.format(formatter[, subset]) Format the text display value of cells.
Styler.set_precision(precision) Set the precision used to render.
Styler.set_table_styles(table_styles) Set the table styles on a Styler.
Styler.set_table_attributes(attributes) Set the table attributes.
Styler.set_caption(caption) Set the caption on a Styler
Styler.set_properties([subset]) Convenience method for setting one or more non-data dependent properties or each cell.
Styler.set_uuid(uuid) Set the uuid for a Styler.
Styler.clear() Reset the styler, removing any previously applied styles.
Styler.pipe(func, *args, **kwargs) Apply func(self, *args, **kwargs), and return the result.

Builtin Styles

Styler.highlight_max([subset, color, axis]) Highlight the maximum by shading the background.
Styler.highlight_min([subset, color, axis]) Highlight the minimum by shading the background.
Styler.highlight_null([null_color]) Shade the background null_color for missing values.
Styler.background_gradient([cmap, low, …]) Color the background in a gradient according to the data in each column (optionally row).
Styler.bar([subset, axis, color, width, …]) Draw bar chart in the cell backgrounds.

Style Export and Import

Styler.render(**kwargs) Render the built up styles to HTML.
Styler.export() Export the styles to applied to the current Styler.
Styler.use(styles) Set the styles on the current Styler, possibly using styles from Styler.export.
Styler.to_excel(excel_writer[, sheet_name, …]) Write Styler to an Excel sheet.
Scroll To Top