Skip to content

Commit

Permalink
Deprecate zipcode for state_zipcode in acs5
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnie-llamado committed Jun 8, 2021
1 parent 5c37d30 commit 20d238f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions census/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,20 @@ def state_county_blockgroup(self, fields, state_fips, county_fips,

@supported_years(2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011)
def zipcode(self, fields, zcta, **kwargs):
warnings.warn(
"zipcode has been deprecated; use state_zipcode instead",
DeprecationWarning
)

state_fips = kwargs.pop('state_fips')

return self.state_zipcode(fields, state_fips, zcta, **kwargs)

@supported_years(2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011)
def state_zipcode(self, fields, state_fips, zcta, **kwargs):
return self.get(fields, geo={
'for': 'zip code tabulation area:{}'.format(zcta),
'in': 'state:{}'.format(state_fips),
}, **kwargs)


Expand Down
2 changes: 1 addition & 1 deletion census/tests/test_census.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_acs5(self):
'State Senate District 7 (2018), Maryland'),
('state_legislative_district_lower',
'State Legislative District 7 (2018), Maryland'),
('zipcode', 'ZCTA5 20877'),
('state_zipcode', 'ZCTA5 20877'),
)

self.check_endpoints('acs5', tests)
Expand Down

0 comments on commit 20d238f

Please sign in to comment.