Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support census blocks? #111

Open
Kirkman opened this issue Feb 4, 2022 · 3 comments
Open

Support census blocks? #111

Kirkman opened this issue Feb 4, 2022 · 3 comments

Comments

@Kirkman
Copy link

Kirkman commented Feb 4, 2022

Thanks for the fantastic library. I noticed that there is support for obtaining block-group-level data, but not block-level. Is there any chance you can add support for blocks?

@WrightWillT
Copy link

IIRC, while the Census collects data at the block level, they only report at the block-group level and above.

@Kirkman
Copy link
Author

Kirkman commented Feb 22, 2023

No, their API does provide block-level data for some datasets. For example, the 2020 Redistricting Data Summary File (PL 94-171) has block-level data.

You can test this for yourself by adding the following function to core.py:

@supported_years()
def state_county_block(self, fields, state_fips, county_fips, block, tract=None, **kwargs):
	geo = {
		'for': 'block:{}'.format(block),
		'in': 'state:{} county:{}'.format(state_fips, county_fips),
	}
	if tract:
		geo['in'] += ' tract:{}'.format(tract)
	return self.get(fields, geo=geo, **kwargs)

And then running a query like this:

data = c.pl.state_county_block(
	('NAME', 'P1_001N'), # table
	'29', # state
	'189', # county
	Census.ALL, # blockgroup
	year='2020'
)

@PhilipMathieu
Copy link

@Kirkman mind if I copy this and do a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants