Notebooks render years as "2,027" — int32/int64 year columns hit marimo table thousands-separator formatting #643

Closed
opened 2026-08-18 13:59:45 +00:00 by kert · 0 comments
Owner

Systemic display bug. marimo's data-table viewer (raw DataFrame cell output and mo.ui.table) formats integer columns with locale thousands separators, so any year-like column that reaches a table as int32/int64 (DuckDB SELECT year) or Python-int-built pl.DataFrame renders as 2,027.

Affected display sites (chart axes are safe — all year axes already use :O; Vega tooltips print numbers unformatted):

  • notebooks/pfs_calcs.py — carrier_result, sql_result raw displays (year)
  • notebooks/pfs_reconciliation.py — result.deltas raw display (year)
  • notebooks/cy2026_pfs_proposed_rule.py — apm_thresholds raw display (performance_year, payment_year)
  • notebooks/cy2027_pfs_proposed_rule.py — apm_thresholds raw display (qp_performance_period, payment_year)
  • notebooks/cms_quality_measures.py — pipeline-result accordions mo.ui.table(_df.head(50)) (frames carry performance_year)

Fix: add conf.display.plain_years(df, *cols) — casts year-like integer columns (year, *_year, *_period; autodetected, or explicit) to strings at the display boundary only, leaving analysis frames integer-typed — and apply it at each site above. Unit-tested for polars and pandas.

**Systemic display bug.** marimo's data-table viewer (raw DataFrame cell output and `mo.ui.table`) formats integer columns with locale thousands separators, so any year-like column that reaches a table as int32/int64 (DuckDB `SELECT year`) or Python-int-built `pl.DataFrame` renders as `2,027`. Affected display sites (chart axes are safe — all year axes already use `:O`; Vega tooltips print numbers unformatted): - `notebooks/pfs_calcs.py` — `carrier_result`, `sql_result` raw displays (`year`) - `notebooks/pfs_reconciliation.py` — `result.deltas` raw display (`year`) - `notebooks/cy2026_pfs_proposed_rule.py` — `apm_thresholds` raw display (`performance_year`, `payment_year`) - `notebooks/cy2027_pfs_proposed_rule.py` — `apm_thresholds` raw display (`qp_performance_period`, `payment_year`) - `notebooks/cms_quality_measures.py` — pipeline-result accordions `mo.ui.table(_df.head(50))` (frames carry `performance_year`) **Fix:** add `conf.display.plain_years(df, *cols)` — casts year-like integer columns (`year`, `*_year`, `*_period`; autodetected, or explicit) to strings at the display boundary only, leaving analysis frames integer-typed — and apply it at each site above. Unit-tested for polars and pandas.
kert added the qualitynotebooks labels 2026-08-18 13:59:45 +00:00
kert closed this issue 2026-08-18 14:08:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: homelab/stack#643