bolster.data_sources.nisra.pxstat
NISRA PxStat API client.
Provides access to the NISRA open data API at https://data.nisra.gov.uk/, powered by the PxStat platform (https://github.com/CSOIreland/PxStat).
The API is publicly accessible without authentication and has no observed rate limits, making it a more reliable alternative to scraping Excel files from publication pages.
API endpoint pattern:
GET https://ws-data.nisra.gov.uk/public/api.restful/
PxStat.Data.Cube_API.ReadDataset/{MATRIX}/CSV/1.0/en
CSV responses include a UTF-8 BOM — always decode with utf-8-sig.
Example:
>>> from bolster.data_sources.nisra.pxstat import read_dataset
>>> df = read_dataset("WDTHS")
>>> "VALUE" in df.columns
True
Attributes
Exceptions
Raised when the PxStat API returns an unexpected response. |
Functions
|
Fetch a dataset from the NISRA PxStat API as a DataFrame. |
Module Contents
- exception bolster.data_sources.nisra.pxstat.PxStatError[source]
Bases:
ExceptionRaised when the PxStat API returns an unexpected response.
Initialize self. See help(type(self)) for accurate signature.
- bolster.data_sources.nisra.pxstat.read_dataset(matrix, timeout=30)[source]
Fetch a dataset from the NISRA PxStat API as a DataFrame.
- Parameters:
- Returns:
DataFrame with raw API columns. The
VALUEcolumn contains the numeric values; all other columns are dimension labels and codes.- Raises:
PxStatError – If the API returns a non-200 response.
- Return type:
Example
>>> df = read_dataset("WDTHS") >>> "VALUE" in df.columns True