github posit-dev/great-tables v0.22.0

2 hours ago

Great Tables v0.22.0 is a feature-rich release that greatly expands the formatting, text manipulation, and export capabilities of the library. Highlights include new methods for footnotes, duration formatting, parts-per notation, summary rows, and specialized column merges. A new suite of text_*() methods provides powerful cell-content transformations, while gtsave() replaces the deprecated save() with a modern headless-Chrome export pipeline. LaTeX output now supports stubs, row groups, and Markdown/HTML conversion. Pandas is no longer a required dependency—Polars-only usage is fully supported.

New Features

  • tab_footnote() — Add table footnotes with automatic, sequentially-ordered marks (symbols, numbers, or letters) attached to targeted cells. Supports placement control and styled text via md() and html(). (#763)
  • fmt_duration() — Format duration values in narrow (5d 3h), wide (5 days, 3 hours), colon-separated (02:15:30), or ISO 8601 styles. Auto-detects Polars Duration dtype and supports locale-aware plural forms. (#831)
  • fmt_partsper() — Format values as parts-per quantities (per-mille ‰, ppm, ppb, ppt, and more) with automatic scaling and context-aware symbol rendering for HTML and LaTeX. (#837)
  • cols_reorder() — Completely rearrange all table columns in a single call, replacing multiple cols_move_*() invocations for full reordering. (#625)
  • cols_merge_*() methods — Specialized column merge variants: cols_merge_uncert() for value ± uncertainty, cols_merge_range() for begin–end ranges, cols_merge_n_pct() for count (percent) pairs, and the generic cols_merge() with pattern templating. (#832)
  • summary_rows() — Add group-wise summary rows (e.g., totals, means) above or below each row group, with support for Polars expressions and custom aggregation functions. (#834)
  • text_transform() and text_*() methods — New text manipulation suite: text_transform() for custom functions, text_replace() for regex substitution, text_case_match() for switch-like replacements, and text_case_when() for predicate-based logic. (#835, #836)
  • Substitution family methods — Replace specific cell values with sub_missing(), sub_zero(), sub_small_vals(), sub_large_vals(), and sub_values() for clean, readable tables. (#833)
  • gtsave() — Save tables to PNG, JPEG, WebP, or PDF using headless Chrome with viewport, zoom, and padding controls. Replaces the deprecated save() method. (#841)

Enhancements

  • LaTeX output now fully supports stubs and row groups, including spanning headers and row-group-as-column layout. (#784)
  • Markdown and HTML content is now converted to LaTeX equivalents during LaTeX rendering. (#803)
  • Nanoplot scaling now correctly respects row selections rather than scaling across all data. (#404)
  • Pandas is no longer a required dependency—Great Tables works with Polars alone for lightweight installs. (#839)

Bug Fixes

  • Polars container dtype entries (e.g., lists) are now correctly converted in _get_cell. (#794)
  • PyArrow array slicing in data_color now works correctly. (#741)
  • A charset meta tag is now prepended to HTML output in save() for proper encoding. (#823)
  • Nanoplot number streams now gracefully handle nan values. (#838)
  • Removed the internal NpNan backend in favor of expanded normalization logic. (#840)

Documentation

  • Added a SEPTA timetable blog post demonstrating real-world table construction. (#636)
  • Fixed a formatting issue in the fmt_threshold() docstring. (#821)
  • Migrated the documentation site to Great Docs as the website generator. (#842)
  • Updated the User Guide with coverage of new features. (#843)

New Contributors

Don't miss a new great-tables release

NewReleases is sending notifications on new releases.