pandas.io.formats.style.Styler.highlight_null β pandas 3.0.0.dev0+2103.g41968a550a documentation (original) (raw)
Styler.highlight_null(color='red', subset=None, props=None)[source]#
Highlight missing values with a style.
Parameters:
colorstr, default βredβ
Background color to use for highlighting.
subsetlabel, array-like, IndexSlice, optional
A valid 2d input to DataFrame.loc[], or, in the case of a 1d input or single key, to DataFrame.loc[:, ] where the columns are prioritised, to limit data
to before applying the function.
propsstr, default None
CSS properties to use for highlighting. If props
is given, color
is not used.
Returns:
Styler
Instance of class where null values are highlighted with given style.
Examples
df = pd.DataFrame({"A": [1, 2], "B": [3, np.nan]}) df.style.highlight_null(color="yellow")
Please see:Table Visualization for more examples.