Skip to main content

Module numfmt

Module numfmt 

Source
Expand description

Display-time number formatting: digit grouping (thousands separators), decimal separator choice, and optional fixed float precision.

This is display-only. Exports, queries, filter values, views, and group-by key strings always use raw values — see format_any_value call sites. Nothing here is ever fed back into Polars.

§Performance

Formatting runs once per visible cell per frame (roughly visible_rows * visible_cols), so the hot path is deliberately allocation free beyond the destination String the caller already needs:

  • Integers are written digit-by-digit into a stack buffer with separators emitted inline — one pass, no intermediate string.
  • NumberFormat::width_i64 computes display width arithmetically, so the locked-column measurement pass never builds a string it throws away.
  • Per-column decisions (dtype eligibility, exclude globs) resolve to a CellFormatter once per column per frame, never per cell.

Structs§

Glob
Minimal glob matcher supporting * (any run) and ? (one character).
NumberFormat
How numbers are rendered. Resolved from config once at load time.
NumberFormatSettings
Fully resolved display-formatting settings, held in the render context.

Enums§

CellFormatter
Per-column formatting decision, resolved once per column per frame.
Grouping
Digit grouping style.

Functions§

display_width
Cells a value takes on screen without building its string, where possible.
format_any_value
Format one Polars value for display.
group_chrome
Comma-group a count for the application’s own chrome — the control bar’s row count, info-panel totals, and similar labels.
is_numeric_dtype
True for dtypes whose values are numbers we group.
is_right_aligned_dtype
True for dtypes that should render flush-right in the data table.
preset_for_locale_tag
Map a POSIX locale / language tag to the preset whose conventions match.
system_locale_tag
Read the environment’s numeric locale, honouring POSIX precedence. Returns None when unset or explicitly the C/POSIX locale.