pandas.io.formats.style.Styler.set_uuid#
- Styler.set_uuid(uuid)[source]#
Set the uuid applied to
idattributes of HTML elements.- Parameters:
- uuidstr
The uuid to be applied to
idattributes of HTML elements.
- Returns:
- Styler
Instance of class with specified uuid for id attributes set.
See also
Styler.set_captionSet the text added to a
<caption>HTML element.Styler.set_td_classesSet the
classattribute of<td>HTML elements.Styler.set_tooltipsSet the DataFrame of strings on
Stylergenerating:hovertooltips.
Notes
Almost all HTML elements within the table, and including the
<table>element are assignedidattributes. The format isT_uuid_<extra>where<extra>is typically a more specific identifier, such asrow1_col2.Examples
>>> df = pd.DataFrame([[1, 2], [3, 4]], index=["A", "B"], columns=["c1", "c2"])
You can get the id attributes with the following:
>>> print((df).style.to_html())
To add a title to column c1, its id is T_20a7d_level0_col0:
>>> df.style.set_uuid("T_20a7d_level0_col0").set_caption("Test") ...
Please see: Table visualization for more examples.