Skip to main content
`Ctrl`+`K`

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

Styler.set_properties(subset=None, **kwargs)

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

  Parameters:
    subset label, 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.

    **kwargs dict

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

  Returns:
    Styler
      Instance of class with CSS-properties set for each `<td>` HTML element

        in the given subset

  See also

  `Styler.set_sticky`

    Add CSS to permanently display the index or column headers in a scrolling frame.

  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.