Skip to main content
`Ctrl`+`K`

# pandas.io.formats.style.Styler.set_caption

Styler.set_caption(caption)

  Set the text added to a `<caption>` HTML element.

  Parameters:
    caption str, tuple, list

      For HTML output either the string input is used or the first element of the tuple. For LaTeX the string input provides a caption and the additional tuple input allows for full captions and short captions, in that order.

  Returns:
    Styler

      Instance of class with text set for `<caption>` HTML element.

  See also

  `Styler.set_td_classes`

    Set the `class` attribute of `<td>` HTML elements.

  `Styler.set_tooltips`

    Set the DataFrame of strings on `Styler` generating `:hover` tooltips.

  `Styler.set_uuid`

    Set the uuid applied to `id` attributes of HTML elements.

  Examples

      >>> df = pd.DataFrame({"A": [1, 2], "B": [3, 4]})
      >>> df.style.set_caption("test")

  Please see: Table Visualization for more examples.