SI-Prefix Number
representation.numeric.si_numberHuman-readable number with SI/business notation suffix indicating magnitude. Common in dashboards, reports, and financial summaries. K=thousands, M=millions, B=billions, T=trillions. May include optional currency prefix ($, €, £) or sign (+/-).
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As DOUBLE |
|---|---|
| 12.2K | 12200.0 |
| 1.5M | 1500000.0 |
| 2.3B | 2300000000.0 |
| $500K | 500000.0 |
| -1.2M | 1200000.0 |
Shape
^[\$€£+-]?\d+\.?\d*[KkMmBbTt]$| Value | Length | Shape |
|---|---|---|
| 12.2K | 5 | matches |
| 1.5M | 4 | matches |
| 2.3B | 4 | matches |
| $500K | 5 | matches |
| -1.2M | 5 | matches |
| 12.2 | 4 | rejected: one character short |
Background
Origin
In written English, the symbol K is often used informally to indicate a multiple of thousand in many contexts.[1]
FineType's registry says this type was inspired by the python-ballpark library's business notation.[2] The python-ballpark library introduces business notation as an offshoot of engineering notation, for producing better human-readable numbers.[3][4] The ballpark package on PyPI lists Stijn Debrouwere as its author.[4] The python-ballpark README shows business notation turning 11234.22, 233000.55 and 1175125.2 into 11.2K, 233K and 1.18M when each value is formatted on its own.[3] The python-ballpark README observes that, even with a thousands separator, at a glance you might easily mistake a billion for a trillion.[3]
Use
Unicode's LDML specification, UTS #35, describes compact number formats that can produce strings like “$10K” or “$3–7M”.[5] UTS #35 says the short non-currency compact format is designed for UI environments where space is at a premium.[5] MDN documents that JavaScript's Intl.NumberFormat, given notation "compact" and compactDisplay "short" in the en-GB locale, formats 987654321 as 988M.[6] MDN's example of compact notation in the zh-CN locale formats 987654321 as 9.9亿.[6] In a Microsoft Excel custom number format, a comma that follows a digit placeholder scales the number by 1,000.[7] Microsoft's guidelines show the format 0.0,,"M" displaying 12200000 as 12.2M.[7]
Wikipedia warns that an informal K could be confused with the symbol for the kelvin temperature unit if the context is unclear.[1]
When converting, strip any currency symbol and sign separately, keep the sign, scale by the suffix, and keep the raw string beside the number so the rounding stays visible. (Meridian's view) Check whether the column mixes suffixed values with plain numbers, or K, M and B in the same field, before deciding a single rule fits every row. (Meridian's view)
Sources
- [1]Metric prefixsecondary source
- [2]finetype/labels/definitions_representation.yaml at main · meridian-online/finetypeFineType
- [3]GitHub - debrouwere/python-ballpark: Better human-readable numberssecondary source
- [4]ballpark · PyPIsecondary source
- [5]Unicode Locale Data Markup Language (LDML) Part 3: Numbersstandard
- [6]Intl.NumberFormat() constructor - JavaScript | MDNdocumentation
- [7]Review guidelines for customizing a number formatdocumentation
Detection notes
Inspired by python-ballpark library "business notation." Extremely common in web dashboards, financial reports, and social media metrics (e.g., "1.2M followers"). The pattern requires a trailing suffix letter to distinguish from plain numbers.
Use it
$ finetype infer -i "12.2K" --mode column
→ representation.numeric.si_number
SELECT ft_infer('12.2K');
-- → 'representation.numeric.si_number'CASE
WHEN regexp_extract(regexp_replace({col}, '^[\\$€£+-]', ''), '[KkMmBbTt]$') IN ('K','k')
THEN CAST(regexp_replace(regexp_replace({col}, '^[\\$€£+-]', ''), '[Kk]$', '') AS DOUBLE) * 1000
WHEN regexp_extract(regexp_replace({col}, '^[\\$€£+-]', ''), '[KkMmBbTt]$') IN ('M','m')
THEN CAST(regexp_replace(regexp_replace({col}, '^[\\$€£+-]', ''), '[Mm]$', '') AS DOUBLE) * 1000000
WHEN regexp_extract(regexp_replace({col}, '^[\\$€£+-]', ''), '[KkMmBbTt]$') IN ('B','b')
THEN CAST(regexp_replace(regexp_replace({col}, '^[\\$€£+-]', ''), '[Bb]$', '') AS DOUBLE) * 1000000000
WHEN regexp_extract(regexp_replace({col}, '^[\\$€£+-]', ''), '[KkMmBbTt]$') IN ('T','t')
THEN CAST(regexp_replace(regexp_replace({col}, '^[\\$€£+-]', ''), '[Tt]$', '') AS DOUBLE) * 1000000000000
END
Schema
https://meridian.online/schemas/representation.numeric.si_number · Frictionless type number
finetype taxonomy representation.numeric.si_number -o json-schema