Philippine population statistics
get_population_statsRetrieve Philippine population figures from official PSA census data, with options for region, city, or barangay via PSGC code, and support for historical census years.
Instructions
Population from the PSA Census of Population, discovered live on OpenSTAT.
Defaults to the latest census PSA publishes: the 2024 Census of Population,
reference date 2024-07-01, as of 2026-09. Pass year for an older census
(2010, 2015, 2020). Every result names its census, reference date and
geography level, and for the 2024 tables the PSGC code PSA keyed the row
on. Examples:
get_population_stats() national total, latest census get_population_stats(region="NCR") one region, province or HUC by PSA label get_population_stats(region="Cebu", year=2020) get_population_stats(psgc_code="0831600000") City of Tacloban, 2024 Census get_population_stats(psgc_code="083747000") same place, 9-digit code get_population_stats(psgc_code="1380100001") one barangay, 2024 Census
On failure: data_status is "unavailable" when PSA is down, with upstream_error true. data_status is "invalid_request" for an unknown region, year, or PSGC code, with validation_error true. data_status is "empty" when a valid PSGC code has no row in the chosen census table. caveats always carries the real error text. population is None in every failure. Failures are never cached.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | No | Census year. None picks the latest. A year PSA has no census for returns validation_error with available_vintages. | |
| region | No | Region, province or highly urbanized city as PSA labels it, such as "NCR", "Region VII", "CAR", "BARMM", "Leyte", "City of Manila". None returns the national total. | |
| psgc_code | No | A 9- or 10-digit PSGC code from resolve_ph_location. Reaches cities, municipalities and barangays (2024 Census only). Not combined with region. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||