pandas.io.formats.style.Styler.set_properties#

Styler.set_properties(subset=None, **kwargs)[source]#

Set defined CSS-properties to each <td> HTML element for the given subset.

Parameters:
subsetlabel, array-like, IndexSlice, optional

A valid 2d input to DataFrame.loc[<subset>], or, in the case of a 1d input or single key, to DataFrame.loc[:, <subset>] where the columns are prioritised, to limit data to before applying the function.

**kwargsdict

A dictionary of property, value pairs to be set for each cell.

Returns:
Styler

Notes

This is a convenience methods which wraps the Styler.map() calling a function returning the CSS-properties independently of the data.

Examples

>>> df = pd.DataFrame(np.random.randn(10, 4))
>>> df.style.set_properties(color="white", align="right")  
>>> df.style.set_properties(**{'background-color': 'yellow'})  

See Table Visualization user guide for more details.