Styler.set_tooltips(ttips, props=None, css_class=None)[source]

Add string based tooltips that will appear in the Styler HTML result. These tooltips are applicable only to`<td>` elements.

New in version 1.3.0.


DataFrame containing strings that will be translated to tooltips, mapped by identical column and index values that must exist on the underlying Styler data. None, NaN values, and empty strings will be ignored and not affect the rendered HTML.

propslist-like or str, optional

List of (attr, value) tuples or a valid CSS string. If None adopts the internal default values described in notes.

css_classstr, optional

Name of the tooltip class used in CSS, should conform to HTML standards. Only useful if integrating tooltips with external CSS. If None uses the internal default value ‘pd-t’.



Tooltips are created by adding <span class=”pd-t”></span> to each data cell and then manipulating the table level CSS to attach pseudo hover and pseudo after selectors to produce the required the results.

The default properties for the tooltip CSS class are:

  • visibility: hidden

  • position: absolute

  • z-index: 1

  • background-color: black

  • color: white

  • transform: translate(-20px, -20px)

The property ‘visibility: hidden;’ is a key prerequisite to the hover functionality, and should always be included in any manual properties specification, using the props argument.

Tooltips are not designed to be efficient, and can add large amounts of additional HTML for larger tables, since they also require that cell_ids is forced to True.


Basic application

>>> df = pd.DataFrame(data=[[0, 1], [2, 3]])
>>> ttips = pd.DataFrame(
...    data=[["Min", ""], [np.nan, "Max"]], columns=df.columns, index=df.index
... )
>>> s =

Optionally controlling the tooltip visual display

>>>, css_class='tt-add', props=[
...     ('visibility', 'hidden'),
...     ('position', 'absolute'),
...     ('z-index', 1)])
>>>, css_class='tt-add',
...     props='visibility:hidden; position:absolute; z-index:1;')