diff --git a/src/skrubview/_data/templates/table-part.html b/src/skrubview/_data/templates/table-part.html index 1842fcd..c0f0bf9 100644 --- a/src/skrubview/_data/templates/table-part.html +++ b/src/skrubview/_data/templates/table-part.html @@ -15,12 +15,12 @@ data-value-repr="{{ row[idx].__repr__() }}" data-col-name-str="{{ summary.head.header[idx] }}" data-col-name-repr="{{ summary.head.header[idx].__repr__() }}" - {%- if row[idx] is none -%} + {%- if row[idx] | is_null -%} data-value-is-none="" {%- endif -%} data-dataframe-module="{{ summary.dataframe_module }}" onclick="displayValue(event)"> - {%- if row[idx] is not none -%} + {%- if not (row[idx] | is_null) -%} {{ row[idx] }} {%- endif -%} diff --git a/src/skrubview/_html.py b/src/skrubview/_html.py index d2b744e..30effb9 100644 --- a/src/skrubview/_html.py +++ b/src/skrubview/_html.py @@ -3,6 +3,7 @@ import secrets import jinja2 +import pandas as pd try: from skrub import _selectors as s @@ -46,6 +47,7 @@ def _get_jinja_env(): "filter_isin_snippet", ]: env.filters[function_name] = getattr(_utils, function_name) + env.filters["is_null"] = pd.isna return env