{"id":37712706,"url":"https://github.com/datasciencecampus/census21api","last_synced_at":"2026-01-16T13:21:17.785Z","repository":{"id":203942929,"uuid":"706682497","full_name":"datasciencecampus/census21api","owner":"datasciencecampus","description":"A Python wrapper for the England \u0026 Wales Census 2021 \"Create a Custom Dataset\" API ","archived":false,"fork":false,"pushed_at":"2024-02-21T16:34:17.000Z","size":1193,"stargazers_count":6,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-04T19:50:08.519Z","etag":null,"topics":["census-api","census-data","data-access","office-for-national-statistics"],"latest_commit_sha":null,"homepage":"https://datasciencecampus.github.io/census21api/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datasciencecampus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-18T12:30:00.000Z","updated_at":"2025-01-28T20:44:50.000Z","dependencies_parsed_at":"2025-04-11T11:30:02.647Z","dependency_job_id":"c480dc3e-77f6-4e66-8d00-d53b3e49c702","html_url":"https://github.com/datasciencecampus/census21api","commit_stats":null,"previous_names":["michaelalawrenceons/census21_cacd_wrapper","datasciencecampus/census21api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/datasciencecampus/census21api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasciencecampus%2Fcensus21api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasciencecampus%2Fcensus21api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasciencecampus%2Fcensus21api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasciencecampus%2Fcensus21api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datasciencecampus","download_url":"https://codeload.github.com/datasciencecampus/census21api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasciencecampus%2Fcensus21api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["census-api","census-data","data-access","office-for-national-statistics"],"created_at":"2026-01-16T13:21:17.180Z","updated_at":"2026-01-16T13:21:17.780Z","avatar_url":"https://github.com/datasciencecampus.png","language":"Python","readme":"# `census21api`: a Python interface to the 2021 England and Wales Census\n\nThis repository contains the unofficial Python interface to the\n[\"Create a Custom Dataset\"](https://www.ons.gov.uk/datasets/create) tool for\nthe 2021 England and Wales Census. This interface was developed by the 2023\ncohort of ONS (Office for National Statistics) Data Engineering and\nArchitecture apprentices with support from the Data Science Campus.\n\nThe primary goal of this project is to simplify and streamline the process of\naccessing and working with 2021 England and Wales Census data.\n\nThe `census21api` package provides a core class, `CensusAPI`, through which\nusers can interact with the Create a Custom Dataset API, enabling users to\nquery tables and retrieve metadata in a programmatic way. It offers a more\nuser-friendly and efficient way to work with the census data, particularly for\ndata engineering and analysis tasks.\n\n## Getting Started\n\n### Installation\n\nCurrently, the `census21api` package is only installable through GitHub. We\nalso require Python 3.8 or higher.\n\nTo install from GitHub via `pip`:\n\n```bash\n$ python -m pip install census21api@git+https://github.com/datasciencecampus/census21api\n```\n\nOr directly from source:\n\n```bash\n$ git clone https://github.com/datasciencecampus/census21api.git\n$ cd census21api\n$ python -m pip install .\n```\n\n### Documentation\n\nWe have developed a full documentation site for the package, which is available\nat: [datasciencecampus.github.io/census21api](https://datasciencecampus.github.io/census21api)\n\n### Usage\n\nHere's a basic example of how to use the `CensusAPI` class to retrieve a table:\n\n```python\n\u003e\u003e\u003e from census21api import CensusAPI\n\u003e\u003e\u003e \n\u003e\u003e\u003e api = CensusAPI()\n\u003e\u003e\u003e \n\u003e\u003e\u003e # Specify a population type, area type, and some dimensions\n\u003e\u003e\u003e # See `census21api.constants` for a list of options\n\u003e\u003e\u003e population_type = \"UR_HH\"\n\u003e\u003e\u003e area_type = \"ctry\"\n\u003e\u003e\u003e dimensions = (\"sex\", \"hh_deprivation_housing\")\n\u003e\u003e\u003e \n\u003e\u003e\u003e # Submit the parameters to the table querist method\n\u003e\u003e\u003e table = api.query_table(population_type, area_type, dimensions)\n\u003e\u003e\u003e print(table)\n         ctry  sex  hh_deprivation_housing     count population_type\n0   E92000001    1                      -8         0           UR_HH\n1   E92000001    1                       0  24993178           UR_HH\n2   E92000001    1                       1   3340293           UR_HH\n3   E92000001    2                      -8         0           UR_HH\n4   E92000001    2                       0  23890474           UR_HH\n5   E92000001    2                       1   3280355           UR_HH\n6   W92000004    1                      -8         0           UR_HH\n7   W92000004    1                       0   1457330           UR_HH\n8   W92000004    1                       1    100914           UR_HH\n9   W92000004    2                      -8         0           UR_HH\n10  W92000004    2                       0   1391731           UR_HH\n11  W92000004    2                       1    101574           UR_HH\n\n```\n\n\u003e [!TIP]\n\u003e If you encounter SSL verification issues, you can bypass this step by\n\u003e setting the `verify` parameter when creating an instance of `CensusAPI`:\n\u003e ```python\n\u003e api_unverified = CensusAPI(verify=False)\n\u003e ```\n\u003e In general, this is \u003cins\u003enot recommended\u003c/ins\u003e as SSL verification helps\n\u003e ensure the security of your machine and its connection to the internet.\n\u003e Please use this at your own discretion.\n\n\n## Limitations\n\nThe `CensusAPI` class includes a variety of methods to interact with the API in\na very flexible way. However, there are still some limitations when compared\nwith the web interface; these come from the API itself, which is still in\ndevelopment.\n\nIf you notice something wrong or something missing, consider making a\ncontribution or opening an issue.\n\n### Blocked dimension combinations\n\nSome combinations of columns (dimensions) cannot be queried at once. See\n[#39](https://github.com/datasciencecampus/issues/39) for an example. This is a\ndeliberate block put in place by the developers of the API.\n\n### Some columns are missing\n\nDespite the stringent statistical disclosure control all public ONS tables go\nthrough, some dimensions are not available in the API. For instance, you cannot\nquery tables containing age data despite being able to create them through the\nweb interface. Again, this is a deliberate choice by the developers and may be\nsubject to change.\n\n\n## Contributing\n\nThis project is open-source, and contributions from the community are welcome.\nIf you want to contribute to the project, please follow these steps:\n\n1. Fork the repository and clone your fork.\n2. Install the development dependencies for the package with\n   `python -m pip install -e \".[dev]\"`.\n2. Create your feature branch.\n3. Make your changes, including writing property-based tests and documentation\n   for your new feature.\n4. Commit and push to the branch on your fork.\n5. Open a pull request and request a review.\n\nPlease make sure to follow the project's coding standards and maintain a clean\ncommit history for easier code review.\n\n## Contact\n\nFor questions, feedback, or inquiries about this project, please open an issue\nand we will get back to you as soon as possible.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatasciencecampus%2Fcensus21api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatasciencecampus%2Fcensus21api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatasciencecampus%2Fcensus21api/lists"}