great-tables icon indicating copy to clipboard operation
great-tables copied to clipboard

feat: add `compact=` arg to for `fmt_currency()`

Open rich-iannone opened this issue 7 months ago • 1 comments

This PR adds the compact= parameter to fmt_currency(), so that values such as $12,345 can render as $12.34K. The behavior of compact= here is the same as in other formatters like fmt_number() and fmt_integer().

Here's an example of its use:

from great_tables import GT, exibble

GT(exibble[["num", "currency"]]).fmt_currency(columns="currency", scale_by=1000, compact=True)
image

Fixes: https://github.com/posit-dev/great-tables/issues/649

rich-iannone avatar Apr 10 '25 18:04 rich-iannone

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.18%. Comparing base (33c7be9) to head (76cdba4). Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #664   +/-   ##
=======================================
  Coverage   91.17%   91.18%           
=======================================
  Files          47       47           
  Lines        5462     5465    +3     
=======================================
+ Hits         4980     4983    +3     
  Misses        482      482           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Apr 10 '25 18:04 codecov[bot]