MeridianMERIDIAN

Numeric Code

representation.identifier.numeric_code

All-digit string where the digit pattern is meaningful and leading zeros must be preserved. Covers ISO country numeric codes (840, 036), FIPS codes, product category codes, and similar classification systems. The critical property is that these values MUST remain as VARCHAR — casting to integer strips leading zeros and destroys the code's identity. Defers to geography.address.postal_code and identity.person.phone_number when those more specific types apply, and to the identity.industry.* leaves (identity.industry.naics) for industry classification codes.

Casts to
VARCHAR

Shape

Pattern
^[0-9]+$
ValueLengthShape
8403matches
0363matches
062matches
060755matches
00014matches
992matches

Told apart

1 of the 3 other identifier types accept every one of these samples on shape alone.

Going the other way, this type's own rule accepts 6 of 6 samples of Increment / Counter.

Column-level disambiguation (header hints, consistent length, leading-zero presence) differentiates from plain integer_number.

Background

Origin

Numeric Code is a type FineType defines itself, for an all-digit string whose digit pattern is meaningful and whose leading zeros must be preserved.[1] FineType's registry names ISO country numeric codes, FIPS codes and product category codes among the classification systems the type covers.[1] FineType's registry notes that the type was added in version 0.5.2 to address leading zeros being stripped when numeric-looking codes are inferred as integers.[1] The type is less a single standard than a family resemblance: codes written in digits, where the digits are labels rather than quantities. (Meridian's view)

ISO 3166-1 numeric codes are three-digit country codes defined in ISO 3166-1.[2] The ISO 3166-1 numeric codes originate in the three-digit country codes of the United Nations Statistics Division's M49 standard.[2] The United Nations publication Standard Country or Area Codes for Statistical Use was originally published as Series M, No. 49 and is now commonly referred to as the M49 standard.[3] The ISO 3166-1 numeric codes were first included in ISO 3166 in its second edition in 1981.[2] Wikipedia's article on ISO 3166-1 numeric gives script independence as an advantage of numeric codes over alphabetic ones.[2]

The US Census Bureau says that INCITS codes were formerly known as Federal Information Processing Standards (FIPS) codes.[4] The Census Bureau's state code list gives California the FIPS state numeric code 06.[5]

Use

Microsoft's support pages say Excel automatically removes leading zeros so that formulas and math operations can work on the values.[6] Microsoft recommends using Excel's Get & Transform (Power Query) to format individual columns as text when importing data.[6] The pandas documentation for read_csv says to use str or object for dtype, together with suitable na_values settings, to preserve values and not interpret their dtype.[7] DuckDB's read_csv has an all_varchar option that skips type detection and treats every column as VARCHAR.[8] DuckDB's CSV reader also accepts a types option that sets column types by position or by name.[8]

The safest habit is to read any column of codes as text from the first step, and to treat a mix of lengths in a column that should be fixed-width as a sign that something upstream has already cast it to a number. (Meridian's view) Re-padding with zeros is only a repair when the code's fixed width is known, as with three-digit country codes; for codes of varying width it can invent values that never existed. (Meridian's view)

Where you'll meet it

The UN Statistics Division's M49 list gives three-digit numerical codes used for statistical processing by the Statistics Division of the United Nations Secretariat.[3]

Detection notes

Added in v0.5.2. Addresses the #2 analyst frustration: leading zeros stripped when numeric-looking codes are auto-inferred as integers. Column-level disambiguation (header hints, consistent length, leading-zero presence) differentiates from plain integer_number.

In Meridian's open data

Use it

CLI · DuckDB
$ finetype infer -i "840" --mode column
→ representation.identifier.numeric_code

SELECT ft_infer('840');
-- → 'representation.identifier.numeric_code'
Cast expression
CAST({col} AS VARCHAR)

Schema

https://meridian.online/schemas/representation.identifier.numeric_code · Frictionless type string

finetype taxonomy representation.identifier.numeric_code -o json-schema

Aliases

codeclassification_codecategory_code

Type Registry