From bc8b9518dbe883f3ad03778d90f46b9d1cd94643 Mon Sep 17 00:00:00 2001 From: Derek Eder Date: Sun, 3 May 2026 22:07:39 -0500 Subject: [PATCH 1/2] adding support for 2000 census --- census/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/census/core.py b/census/core.py index 17dc64a..6deeaac 100644 --- a/census/core.py +++ b/census/core.py @@ -153,7 +153,7 @@ def get(self, fields, geo, year=None, **kwargs): in case the responses are in different orders. GEO_ID is not reliably present in pre-2010 requests. """ - sort_by_geoid = len(fields) > 49 and (not year or year > 2009) + sort_by_geoid = len(fields) > 49 and (not year or year >= 2000) all_results = (self.query(forty_nine_fields, geo, year, sort_by_geoid=sort_by_geoid, **kwargs) for forty_nine_fields in chunks(fields, 49)) merged_results = [merge(result) for result in zip(*all_results)] From 1bf57d3d7f1a366f5bc97784cf853b0a35c67513 Mon Sep 17 00:00:00 2001 From: Derek Eder Date: Sun, 3 May 2026 22:40:23 -0500 Subject: [PATCH 2/2] add state_county_block for 2000 --- census/core.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/census/core.py b/census/core.py index 6deeaac..84f0a6d 100644 --- a/census/core.py +++ b/census/core.py @@ -153,7 +153,7 @@ def get(self, fields, geo, year=None, **kwargs): in case the responses are in different orders. GEO_ID is not reliably present in pre-2010 requests. """ - sort_by_geoid = len(fields) > 49 and (not year or year >= 2000) + sort_by_geoid = len(fields) > 49 and (not year or year > 2009) all_results = (self.query(forty_nine_fields, geo, year, sort_by_geoid=sort_by_geoid, **kwargs) for forty_nine_fields in chunks(fields, 49)) merged_results = [merge(result) for result in zip(*all_results)] @@ -564,7 +564,7 @@ def state_county_tract(self, fields, state_fips, 'in': 'state:{} county:{}'.format(state_fips, county_fips), }, **kwargs) - @supported_years() + @supported_years(2020, 2010) def state_county_blockgroup(self, fields, state_fips, county_fips, blockgroup, tract=None, **kwargs): geo = { @@ -575,6 +575,15 @@ def state_county_blockgroup(self, fields, state_fips, county_fips, geo['in'] += ' tract:{}'.format(tract) return self.get(fields, geo=geo, **kwargs) + @supported_years() + def state_county_block(self, fields, state_fips, county_fips, + tract, block, **kwargs): + return self.get(fields, geo={ + 'for': 'block:{}'.format(block), + 'in': 'state:{} county:{} tract:{}'.format( + state_fips, county_fips, tract), + }, **kwargs) + class Census(object):