-
Notifications
You must be signed in to change notification settings - Fork 31
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
Issue #59 - Inflation Adjustment #157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ class DataStore(object): | |
|
||
def __init__(self): | ||
"""Instantiate a new DataStore object.""" | ||
try: # if any of these aren't found, stream them insteead | ||
try: # if any of these aren't found, stream them instead | ||
from quilt3.data.census import tracts_cartographic, administrative | ||
except ImportError: | ||
warn( | ||
|
@@ -94,7 +94,7 @@ def blocks_2000(self, states=None, convert=True): | |
Parameters | ||
---------- | ||
states : list-like | ||
list of state fips codes to return as a datafrrame. | ||
list of state fips codes to return as a dataframe. | ||
convert : bool | ||
if True, return geodataframe, else return dataframe (the default is True). | ||
|
||
|
@@ -107,7 +107,7 @@ def blocks_2000(self, states=None, convert=True): | |
|
||
""" | ||
|
||
try: # if any of these aren't found, stream them insteead | ||
try: # if any of these aren't found, stream them instead | ||
from quilt3.data.census import blocks_2000 | ||
except ImportError: | ||
warn( | ||
|
@@ -148,7 +148,7 @@ def blocks_2010(self, states=None, convert=True): | |
Parameters | ||
---------- | ||
states : list-like | ||
list of state fips codes to return as a datafrrame. | ||
list of state fips codes to return as a dataframe. | ||
convert : bool | ||
if True, return geodataframe, else return dataframe (the default is True). | ||
|
||
|
@@ -160,7 +160,7 @@ def blocks_2010(self, states=None, convert=True): | |
stored as well-known binary on the 'wkb' column. | ||
|
||
""" | ||
try: # if any of these aren't found, stream them insteead | ||
try: # if any of these aren't found, stream them instead | ||
from quilt3.data.census import blocks_2010 | ||
except ImportError: | ||
warn( | ||
|
@@ -367,7 +367,7 @@ def ncdb(self): | |
|
||
Returns | ||
------- | ||
pandas.DataFrarme | ||
pandas.DataFrame | ||
NCDB as a long-form dataframe | ||
|
||
""" | ||
|
@@ -675,6 +675,31 @@ def store_ncdb(filepath): | |
|
||
df = df.set_index("geoid") | ||
|
||
#### Beginning of New Code #### | ||
|
||
year = df["year"] | ||
|
||
# Inflation logic for ncdb. | ||
inflate_cols = [ | ||
"MDVALHS", | ||
"MDGRENT", | ||
"MDHHY", | ||
] | ||
# Five rows have missing ncdb labels in variables.csv. | ||
# per capita income, missing | ||
# median household income white, missing | ||
# median household income black, missing | ||
# median household income hispanic, missing | ||
# median household income asian, missing | ||
|
||
inflate_available = list(set(df.columns).intersection(set(inflate_cols))) | ||
|
||
if len(inflate_available): | ||
df = adjust_inflation(df, inflate_available, year) | ||
return df | ||
|
||
#### End of New Code #### | ||
Comment on lines
+680
to
+701
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will need to work a little bit differently from the ltdb example. Unlike in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will take a look. |
||
|
||
for row in data_store.codebook["formula"].dropna().tolist(): | ||
try: | ||
df.eval(row, inplace=True) | ||
|
@@ -771,7 +796,7 @@ class Community(object): | |
boundaries (e.g. census tracts, or blocks in the US), and tabular data | ||
which describe the composition of each neighborhood (e.g. data from | ||
surveys, sensors, or geocoded misc.). A Community can be large (e.g. a | ||
metropolitan region), or small (e.g. a handfull of census tracts) and | ||
metropolitan region), or small (e.g. a handful of census tracts) and | ||
may have data pertaining to multiple discrete points in time. | ||
|
||
Parameters | ||
|
@@ -1163,7 +1188,7 @@ def from_ltdb( | |
): | ||
"""Create a new Community from LTDB data. | ||
|
||
Instiantiate a new Community from pre-harmonized LTDB data. To use | ||
Instantiate a new Community from pre-harmonized LTDB data. To use | ||
you must first download and register LTDB data with geosnap using | ||
the `store_ltdb` function. Pass lists of states, counties, or any | ||
arbitrary FIPS codes to create a community. All fips code arguments | ||
|
@@ -1239,7 +1264,7 @@ def from_ncdb( | |
): | ||
"""Create a new Community from NCDB data. | ||
|
||
Instiantiate a new Community from pre-harmonized NCDB data. To use | ||
Instantiate a new Community from pre-harmonized NCDB data. To use | ||
you must first download and register LTDB data with geosnap using | ||
the `store_ncdb` function. Pass lists of states, counties, or any | ||
arbitrary FIPS codes to create a community. All fips code arguments | ||
|
@@ -1314,7 +1339,7 @@ def from_census( | |
): | ||
"""Create a new Community from original vintage US Census data. | ||
|
||
Instiantiate a new Community from . To use | ||
Instantiate a new Community from . To use | ||
you must first download and register census data with geosnap using | ||
the `store_census` function. Pass lists of states, counties, or any | ||
arbitrary FIPS codes to create a community. All fips code arguments | ||
|
@@ -1419,7 +1444,7 @@ def from_lodes( | |
): | ||
"""Create a new Community from Census LEHD/LODES data. | ||
|
||
Instiantiate a new Community from LODES data. | ||
Instantiate a new Community from LODES data. | ||
Pass lists of states, counties, or any | ||
arbitrary FIPS codes to create a community. All fips code arguments | ||
are additive, so geosnap will include the largest unique set. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove these comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.