From efac604340f9dff896301c8cb10181783483b943 Mon Sep 17 00:00:00 2001 From: Nathaniel Flower Date: Wed, 24 Apr 2024 22:06:20 -0400 Subject: [PATCH 1/2] Added tract geometry support for 2008 and 2009 --- pygris/enumeration_units.py | 15 +++++---------- pygris/helpers.py | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/pygris/enumeration_units.py b/pygris/enumeration_units.py index a4db96b..449cb45 100644 --- a/pygris/enumeration_units.py +++ b/pygris/enumeration_units.py @@ -2,7 +2,7 @@ __author__ = "Kyle Walker Date: Wed, 24 Apr 2024 22:12:37 -0400 Subject: [PATCH 2/2] Fixing some stale lines --- pygris/enumeration_units.py | 10 +++++++++- pygris/helpers.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pygris/enumeration_units.py b/pygris/enumeration_units.py index 449cb45..e714916 100644 --- a/pygris/enumeration_units.py +++ b/pygris/enumeration_units.py @@ -90,7 +90,15 @@ def counties(state = None, cb = False, resolution = '500k', year = None, cache = if type(state) is not list: state = [state] valid_state = [validate_state(x) for x in state] - ctys = ctys.query('STATEFP in @valid_state') + + if year == 1990: + state_col = 'ST' + elif year in [2000, 2010]: + state_col = 'STATE' if cb is True else f'STATEFP{yr}' + else: + state_col = 'STATEFP' + + ctys = ctys.query(f'{state_col} in @valid_state') return ctys diff --git a/pygris/helpers.py b/pygris/helpers.py index 363aedc..8df49e1 100644 --- a/pygris/helpers.py +++ b/pygris/helpers.py @@ -78,7 +78,7 @@ def fips_codes(): def validate_state(state, quiet = False): # Standardize as lowercase original_input = state - state = state.lower() + state = str(state).lower() # Get rid of whitespace state = state.strip()