Skip to content

pycensus.census.countries.taiwan.utils

Small stateless helpers shared by every Taiwan census source module.

county_code(county_name_or_code)

Return the 5-digit MOI county/city code for a name, English name, or code.

Parameters:

Name Type Description Default
county_name_or_code str

County/city Chinese name (e.g. "臺北市"), English name (e.g. "Taipei City"), or 5-digit code.

required

Returns:

Type Description
str

Five-digit MOI county/city code.

Raises:

Type Description
ValueError

If the input does not resolve to a known Taiwan county/city.

roc_yyymm_to_year(yyymm)

Convert an ROC (Republic of China calendar) yyymm string to a Gregorian year.

Parameters:

Name Type Description Default
yyymm str

ROC year-month, e.g. "11407" (ROC year 114, month 07).

required

Returns:

Type Description
int

Gregorian year, e.g. 2025 for "11407" (ROC year + 1911).