format_mapping
to transform and display None rows explicitly, but it doesn't. import polars as pl df = pl.DataFrame( { "a": [[None, 1, 2, 3], [4, 5, 6, 7], None], } ).with_row_index("i") mo.ui.table( df, format_mapping={"a": lambda x: "None" if x is None else x}, ) list(map(lambda x: "None" if x is None else x, df["a"]))
format_mapping
, and managed (for my polars df) to get inner null elements printed. But two odd things append with format_mapping
:df = pl.DataFrame( { "a": [[None, 1, 2, 3], [4, 5, 6, 7], None], } ) def fmt_mapping(x): print(f"CALLED FOR {x}") if isinstance(x,pl.Series): return x.cast(pl.String).fill_null("null").str.join(",") return x mo.ui.table( df, format_mapping={"a": fmt_mapping}, )
format_mapping
is skipping None values. I made a PR to apply format_mapping
to None values in table formatting. You should be able to use format_mapping
to print the null elements in the next release.format_mapping
is called twice for every elements, thanks for your experiment ๐