Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
7 of 36 committers (19.4%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.1%) to scientific vocabulary
Keywords
census
census-api
python
Last synced: 6 months ago
·
JSON representation
·
Repository
A Python wrapper for the US Census API.
Basic Info
Statistics
- Stars: 670
- Watchers: 28
- Forks: 144
- Open Issues: 39
- Releases: 4
Topics
census
census-api
python
Created over 13 years ago
· Last pushed 11 months ago
Metadata Files
Readme
License
Citation
README.rst
======
census
======
.. image:: https://github.com/datamade/census/workflows/Python%20package/badge.svg
A simple wrapper for the United States Census Bureau's API.
Provides access to ACS and SF1 data sets.
Install
=======
::
pip install census
You may also want to install a complementary library, `us `_, which help you figure out the
`FIPS `_ codes for many geographies. We use it in the examples below.
::
pip install us
Usage
=====
First, get yourself a `Census API key `_.
::
from census import Census
from us import states
c = Census("MY_API_KEY")
c.acs5.get(('NAME', 'B25034_010E'),
{'for': 'state:{}'.format(states.MD.fips)})
The call above will return the name of the geographic area and the number of
homes that were built before 1939 for the state of Maryland. Helper methods have
been created to simplify common geometry calls::
c.acs5.state(('NAME', 'B25034_010E'), states.MD.fips)
Full details on geometries and the states module can be found below.
The get method is the core data access method on both the ACS and SF1 data sets.
The first parameter is either a single string column or a tuple of columns. The
second parameter is a geoemtry dict with a `for` key and on option `in` key. The
`for` argument accepts a `"*"` wildcard character or `Census.ALL`. The wildcard
is not valid for the `in` parameter.
By default, the year for a dataset is the most recent year available. To access earlier data,
pass a year parameter to the API call::
c.acs5.state(('NAME', 'B25034_010E'), states.MD.fips, year=2010)
The default year may also be set client-wide::
c = Census("MY_API_KEY", year=2010)
Detailed information about the API can be found at the `Census Data API User Guide `_.
Datasets
========
For each dataset, the first year listed is the default.
* acs5: `ACS 5 Year Estimates `_ (2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009)
* acs3: `ACS 3 Year Estimates `_ (2013, 2012)
* acs1: `ACS 1 Year Estimates `_ (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011)
* acs5dp: `ACS 5 Year Estimates, Data Profiles `_ (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009)
* acs3dp: `ACS 3 Year Estimates, Data Profiles `_ (2013, 2012)
* acs1dp: `ACS 1 Year Estimates, Data Profiles `_ (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011)
* acs5st: `ACS 5 Year Estimates, Subject Tables `_ (2023, 2022, 2021, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009)
* sf1: `Census Summary File 1 `_ (2010)
* pl: `Redistricting Data Summary File `_ (2020, 2010, 2000)
Geographies
===========
The API supports a wide range of geographic regions. The specification of these
can be quite complicated so a number of convenience methods are provided. Refer to the `Census API documentation `_
for more geographies beyond the convenience methods.
*Not all geographies are supported in all years. Calling a convenience method
with a year that is not supported will raise census.UnsupportedYearException.*
`Geographic relationship files `_ are provided on the Census developer site as a tool to help users compare the geographies from the 1990, 2000 and 2010 Censuses. From these files, data users may determine how geographies from one Census relate to those from the prior Census.
ACS5 Geographies
----------------
* state(fields, state_fips)
* state_county(fields, state_fips, county_fips)
* state_county_blockgroup(fields, state_fips, county_fips, blockgroup)
* state_county_subdivision(fields, state_fips, county_fips, subdiv_fips)
* state_county_tract(fields, state_fips, county_fips, tract)
* state_place(fields, state_fips, place)
* state_congressional_district(fields, state_fips, congressional_district)
* state_legislative_district_upper(fields, state_fips, legislative_district)
* state_legislative_district_lower(fields, state_fips, legislative_district)
* us(fields)
* state_zipcode(fields, state_fips, zip5)
ACS1 Geographies
----------------
* state(fields, state_fips)
* state_congressional_district(fields, state_fips, district)
* us(fields)
SF1 Geographies
---------------
* state(fields, state_fips)
* state_county(fields, state_fips, county_fips)
* state_county_subdivision(fields, state_fips, county_fips, subdiv_fips)
* state_county_tract(fields, state_fips, county_fips, tract)
* state_place(fields, state_fips, place)
* state_congressional_district(fields, state_fips, district)
* state_msa(fields, state_fips, msa)
* state_csa(fields, state_fips, csa)
* state_district_place(fields, state_fips, district, place)
* state_zipcode(fields, state_fips, zip5)
PL Geographies
--------------
* state(fields, state_fips)
* state_county(fields, state_fips, county_fips)
* state_county_subdivision(fields, state_fips, county_fips, subdiv_fips)
* state_county_tract(fields, state_fips, county_fips, tract)
* state_county_blockgroup(fields, state_fips, county_fips, blockgroup)
* state_place(fields, state_fips, place)
* state_congressional_district(fields, state_fips, district)
* state_legislative_district_upper(fields, state_fips, legislative_district)
* state_legislative_district_lower(fields, state_fips, legislative_district)
States
======
This package previously had a `census.states` module, but now uses the
*us* package. ::
>>> from us import states
>>> print states.MD.fips
u'24'
Convert FIPS to state abbreviation using `lookup()`: ::
>>> print states.lookup('24').abbr
u'MD'
BYOS - Bring Your Own Session
=============================
If you'd prefer to use a custom configured requests.Session, you can pass it
to the Census constructor::
s = requests.session()
s.headers.update({'User-Agent': 'census-demo/0.0'})
c = Census("MY_API_KEY", session=s)
You can also replace the session used by a specific data set::
c.sf1.session = s
Examples
========
The geographic name for all census tracts for county 170 in Alaska::
c.sf1.get('NAME', geo={'for': 'tract:*',
'in': 'state:{} county:170'.format(states.AK.fips)})
The same call using the `state_county_tract` convenience method::
c.sf1.state_county_tract('NAME', states.AK.fips, '170', Census.ALL)
Total number of males age 5 - 9 for all states::
c.acs5.get('B01001_004E', {'for': 'state:*'})
The same call using the state convenience method::
c.acs5.state('B01001_004E', Census.ALL)
Don't know the list of tables in a survey, try this:
c.acs5.tables()
Owner
- Name: datamade
- Login: datamade
- Kind: organization
- Email: info@datamade.us
- Location: Chicago, IL
- Website: http://datamade.us
- Twitter: datamadeco
- Repositories: 123
- Profile: https://github.com/datamade
We build open source technology using open data to empower journalists, researchers, governments and advocacy organizations.
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Carbaugh" given-names: "Jeremy" - family-names: "Gregg" given-names: "Forest" - name: "Contributors" title: "census" version: 0.8.24 date-released: 2024-03-05 url: "https://github.com/datamade/census"
GitHub Events
Total
- Create event: 7
- Release event: 3
- Issues event: 6
- Watch event: 37
- Delete event: 6
- Issue comment event: 5
- Push event: 5
- Pull request review comment event: 2
- Pull request review event: 2
- Pull request event: 5
- Fork event: 8
Last Year
- Create event: 7
- Release event: 3
- Issues event: 6
- Watch event: 37
- Delete event: 6
- Issue comment event: 5
- Push event: 5
- Pull request review comment event: 2
- Pull request review event: 2
- Pull request event: 5
- Fork event: 8
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Forest Gregg | f****g@u****u | 73 |
| Jeremy Carbaugh | j****h@g****m | 39 |
| Hannah Cushman Garland | h****n@d****s | 9 |
| Detlef Knauss | d****k@h****m | 7 |
| thedavidhackett | d****2@u****u | 4 |
| Arturo Ramos | a****s@c****m | 4 |
| Ronnie Llamado | l****e@g****m | 4 |
| J. A. Cooper | A****r@u****g | 4 |
| Jean Cochrane (Lead developer, DataMade) | j****e@d****s | 3 |
| pveigadecamargo | p****o@a****v | 3 |
| Adam Tumminaro | a****m@s****m | 3 |
| Joe Hand | j****e@j****m | 3 |
| Jon Culver | j****r@g****m | 3 |
| Jonathan Giuffrida | 1****a | 3 |
| Phil Rha | p****a@g****m | 3 |
| Max Ghenis | m****s@g****m | 2 |
| Daniel W Bond | d****2@g****u | 2 |
| palewire | b****h@g****m | 2 |
| Tom Hemmes | t****s@g****m | 2 |
| Ben Riffer-Reinert | r****t@u****u | 1 |
| Brian Smith | o****i@g****m | 1 |
| Charlie Kramer | 1****r | 1 |
| Tyler | t****s@g****m | 1 |
| Matthew Hayes | h****s@M****l | 1 |
| Andrew Owen | o****8@u****u | 1 |
| Koshy Thomas | k****3@g****m | 1 |
| Matt Davis | j****b@g****m | 1 |
| Michael Selik | m****e@s****g | 1 |
| Ryan Menezes | r****s@g****m | 1 |
| Ryan Rizner | r****7@g****m | 1 |
| and 6 more... | ||
Committer Domains (Top 20 + Academic)
uchicago.edu: 3
datamade.us: 2
seas.upenn.edu: 1
mattspence.com: 1
selik.org: 1
umn.edu: 1
geophy.com: 1
gmu.edu: 1
joeahand.com: 1
spaceshipb.com: 1
anl.gov: 1
usa.childcareaware.org: 1
coalitioninc.com: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 71
- Total pull requests: 58
- Average time to close issues: 5 months
- Average time to close pull requests: about 2 months
- Total issue authors: 59
- Total pull request authors: 35
- Average comments per issue: 1.72
- Average comments per pull request: 1.29
- Merged pull requests: 41
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 5
- Pull requests: 7
- Average time to close issues: 3 months
- Average time to close pull requests: about 2 months
- Issue authors: 5
- Pull request authors: 3
- Average comments per issue: 0.6
- Average comments per pull request: 0.0
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- fgregg (6)
- jeancochrane (3)
- MaxGhenis (3)
- jksinton (2)
- huhwhy (2)
- nvenkatcivil (2)
- Lekhs711 (1)
- brickett (1)
- praful-dodda (1)
- MethodMan7 (1)
- poulson (1)
- afhaque (1)
- ppolonik2 (1)
- BowenLiu92 (1)
- datapolitan (1)
Pull Request Authors
- fgregg (11)
- arturo-ramos (4)
- cooperjaXC (4)
- ronnie-llamado (3)
- hancush (3)
- bgrobinson (2)
- Eamo5 (2)
- Charlie-Kramer (2)
- thedavidhackett (2)
- mr-fuller (2)
- palewire (2)
- jeancochrane (2)
- JavadocMD (2)
- noahlee826 (1)
- jbandoro (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- pypi 51,312 last-month
- Total docker downloads: 127
-
Total dependent packages: 7
(may contain duplicates) -
Total dependent repositories: 213
(may contain duplicates) - Total versions: 36
- Total maintainers: 6
pypi.org: census
A wrapper for the US Census Bureau's API
- Homepage: http://github.com/datamade/census
- Documentation: https://census.readthedocs.io/
- License: BSD
-
Latest release: 0.8.24
published 11 months ago
Rankings
Dependent repos count: 1.0%
Dependent packages count: 1.6%
Average: 2.5%
Stargazers count: 2.6%
Docker downloads count: 2.6%
Downloads: 3.2%
Forks count: 4.2%
Maintainers (2)
Last synced:
7 months ago
pypi.org: sdcensus
A wrapper for the US Census Bureau's API
- Homepage: http://github.com/datamade/census
- Documentation: https://sdcensus.readthedocs.io/
- License: BSD
-
Latest release: 0.8.31
published about 1 year ago
Rankings
Stargazers count: 2.6%
Forks count: 4.2%
Dependent packages count: 10.1%
Average: 21.0%
Dependent repos count: 67.2%
Maintainers (3)
Last synced:
about 1 year ago
pypi.org: example-package-lennon0926
A wrapper for the US Census Bureau's API
- Homepage: http://github.com/datamade/census
- Documentation: https://example-package-lennon0926.readthedocs.io/
- License: BSD
-
Latest release: 0.0.1
published almost 2 years ago
Rankings
Dependent packages count: 9.6%
Average: 36.6%
Dependent repos count: 63.7%
Maintainers (1)
Last synced:
about 1 year ago
Dependencies
.github/workflows/python-package.yml
actions
- actions/checkout v2 composite
- actions/setup-python v2 composite
requirements.txt
pypi
- pytest >=2.9