ENH: Styler display of NaN / null Values · Issue #21527 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@psychemedia

Description

@psychemedia

The Styler allows for null cells to be highlighted using .style.highlight_null() but a nan text string will also be displayed.

If a column is coloured using .background_gradient() it must be a numeric type otherwise numerical comparisons fail. This means that using a construction of the form ..fillna('') on the column will create an error as the column is cast to an object type.

nan values can be removed in the rendered table using a hack of the form .render().replace('nan','') but it would be cleaner to use something along the lines of .style.replace_null(value) that could be used to tidy up the display of nan cells.