The fmt() method provides a way to execute custom formatting functionality with raw data values in a way that can consider all output contexts.
Along with the columns and rows arguments that provide some precision in targeting data cells, the fns argument allows you to define one or more functions for manipulating the raw data.
Parameters
Name
Type
Description
Default
fns
FormatFn | FormatFns
Either a single formatting function or a named list of functions.
required
columns
SelectExpr
The columns to target. Can either be a single column name or a series of column names provided in a list.
None
rows
int | list[int] | None
In conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in columns being formatted. Alternatively, we can supply a list of row indices.
None
is_substitution
bool
Whether the formatter is a substitution. Substitutions are run last, after other formatters.