pandas.formats.style.Styler

class pandas.formats.style.Styler(data, precision=None, table_styles=None, uuid=None, caption=None, table_attributes=None)[source]

Helps style a DataFrame or Series according to the data with HTML and CSS.

New in version 0.17.1.

Warning

This is a new feature and is under active development. We’ll be adding features and possibly making breaking changes in future releases.

Parameters:

data: Series or DataFrame

precision: int

precision to round floats to, defaults to pd.options.display.precision

table_styles: list-like, default None

list of {selector: (attr, value)} dicts; see Notes

uuid: str, default None

a unique identifier to avoid CSS collisons; generated automatically

caption: str, default None

caption to attach to the table

Notes

Most styling will be done by passing style functions into Styler.apply or Styler.applymap. Style functions should return values with strings containing CSS 'attr: value' that will be applied to the indicated cells.

If using in the Jupyter notebook, Styler has defined a _repr_html_ to automatically render itself. Otherwise call Styler.render to get the genterated HTML.

Attributes

template: Jinja Template