Skip to content

feat: add compact= arg to for fmt_currency()#664

Merged
rich-iannone merged 5 commits into
mainfrom
feat-compact-for-fmt-currency
May 6, 2025
Merged

feat: add compact= arg to for fmt_currency()#664
rich-iannone merged 5 commits into
mainfrom
feat-compact-for-fmt-currency

Conversation

@rich-iannone
Copy link
Copy Markdown
Member

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: #649

@rich-iannone rich-iannone requested a review from machow as a code owner April 10, 2025 18:41
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

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           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@github-actions github-actions Bot temporarily deployed to pr-664 April 10, 2025 18:49 Destroyed
Copy link
Copy Markdown
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed while pairing...

Comment thread great_tables/_formats.py
@github-actions github-actions Bot temporarily deployed to pr-664 May 6, 2025 15:06 Destroyed
Copy link
Copy Markdown
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@rich-iannone rich-iannone merged commit 4a11db5 into main May 6, 2025
14 checks passed
@rich-iannone rich-iannone deleted the feat-compact-for-fmt-currency branch May 6, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add compact to fmt_currency

2 participants