England and Wales Census Data Explorer

The England and Wales 2021 census data have been slowly released over the last few weeks. The raw data can be quite hard to find on the ONS web pages and for many tasks require some reshaping or filtering before they are used.

So I thought I’d build a Census 2021 explorer to make this easier. It allows census variables to be browsed and selected for CSV export as well as queries for filtering and combining tables.

It takes advantage of Observable’s excellent database handling (via DuckDb) and the compact parquet format. And thanks to a tip from @mootari it loads census tables dynamically on demand. This means it is possible to work with a complete database of many tens of millions of rows, only loading tables into memory when needed.

I built the page mainly to support students using UK census data at a range of spatial aggregations for datavis and analysis, but it is hopefully useful for anyone who would like to work with the latest census data whether within Observable or outside.

Any feedback or suggestions for improvements/amendments very welcome.


I’ve added a Hello Census 2021 page to make it clearer how to add census data to your own Observable docs with either some SQL or JavaScript.