.io.formats.style.Styler.set_uuid ](pandas.io.formats.style.Styler.set_uuid.html)
    * [ pandas.io.formats.style.Styler.clear ](pandas.io.formats.style.Styler.clear.html)
    * [ pandas.io.formats.style.Styler.pipe ](pandas.io.formats.style.Styler.pipe.html)
    * [ pandas.io.formats.style.Styler.highlight_null ](pandas.io.formats.style.Styler.highlight_null.html)
    * [ pandas.io.formats.style.Styler.highlight_max ](pandas.io.formats.style.Styler.highlight_max.html)
    * [ pandas.io.formats.style.Styler.highlight_min ](pandas.io.formats.style.Styler.highlight_min.html)
    * [ pandas.io.formats.style.Styler.highlight_between ](pandas.io.formats.style.Styler.highlight_between.html)
    * [ pandas.io.formats.style.Styler.highlight_quantile ](pandas.io.formats.style.Styler.highlight_quantile.html)
    * [ pandas.io.formats.style.Styler.background_gradient ](pandas.io.formats.style.Styler.background_gradient.html)
    * [ pandas.io.formats.style.Styler.text_gradient ](pandas.io.formats.style.Styler.text_gradient.html)
    * [ pandas.io.formats.style.Styler.bar ](pandas.io.formats.style.Styler.bar.html)
    * [ pandas.io.formats.style.Styler.to_html ](pandas.io.formats.style.Styler.to_html.html)
    * [ pandas.io.formats.style.Styler.to_latex ](pandas.io.formats.style.Styler.to_latex.html)
    * [ pandas.io.formats.style.Styler.to_excel ](pandas.io.formats.style.Styler.to_excel.html)
    * [ pandas.io.formats.style.Styler.to_string ](pandas.io.formats.style.Styler.to_string.html)
    * [ pandas.io.formats.style.Styler.export ](pandas.io.formats.style.Styler.export.html)
    * [ pandas.io.formats.style.Styler.use ](pandas.io.formats.style.Styler.use.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ Style ](../style.html)
  * pandas.io.fo... 

#  pandas.io.formats.style.Styler.set_td_classes  #

Styler.  set_td_classes  (  _ classes  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/io/formats/style.py#L1459-L1533) #

    

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

Parameters  :

    

**classes** DataFrame

    

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

Returns  :

    

Styler

    

See also

[ ` Styler.set_table_styles  `
](pandas.io.formats.style.Styler.set_table_styles.html#pandas.io.formats.style.Styler.set_table_styles
"pandas.io.formats.style.Styler.set_table_styles")

    

Set the table styles included within the ` <style> ` HTML element.

[ ` Styler.set_table_attributes  `
](pandas.io.formats.style.Styler.set_table_attributes.html#pandas.io.formats.style.Styler.set_table_attributes
"pandas.io.formats.style.Styler.set_table_attributes")

    

Set the table attributes added to the ` <table> ` HTML element.

Notes

Can be used in combination with ` Styler.set_table_styles  ` to define an
internal CSS solution without reference to external CSS files.

Examples

    
    
    >>> df = pd.DataFrame(data=[[1, 2, 3], [4, 5, 6]], columns=["A", "B", "C"])
    >>> classes = pd.DataFrame([
    ...     ["min-val red", "", "blue"],
    ...     ["red", None, "blue max-val"]
    ... ], index=df.index, columns=df.columns)
    >>> df.style.set_td_classes(classes)  
    

Using  MultiIndex  columns and a  classes  DataFrame  as a subset of the
underlying,

    
    
    >>> df = pd.DataFrame([[1,2],[3,4]], index=["a", "b"],
    ...     columns=[["level0", "level0"], ["level1a", "level1b"]])
    >>> classes = pd.DataFrame(["min-val"], index=["a"],
    ...     columns=[["level0"],["level1a"]])
    >>> df.style.set_td_classes(classes)  
    

Form of the output with new