-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add script to read in depreciation data
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
This model has functions to read in depreciation data | ||
""" | ||
|
||
# imports | ||
import numpy as np | ||
import pandas as pd | ||
from data_paths import get_paths | ||
|
||
globals().update(get_paths()) | ||
|
||
|
||
def get_depr(): | ||
""" | ||
Reads in the list of assets and their economic depreciation values | ||
from BEA data and the tax depriation system for each asset type from | ||
the IRS | ||
Args: | ||
None | ||
Returns: | ||
econ_deprec_rates (DataFrame): economic depreciation rates for | ||
all asset types | ||
""" | ||
econ_deprec_rates = pd.read_csv(_ECON_DEPR_IN_PATH) | ||
econ_deprec_rates = econ_deprec_rates.fillna(0) | ||
econ_deprec_rates.rename( | ||
columns={ | ||
"Code": "bea_asset_code", | ||
"Economic Depreciation Rate": "delta", | ||
}, | ||
inplace=True, | ||
) | ||
econ_deprec_rates["Asset"] = econ_deprec_rates["Asset"].str.strip() | ||
econ_deprec_rates["bea_asset_code"] = econ_deprec_rates[ | ||
"bea_asset_code" | ||
].str.strip() | ||
|
||
tax_deprec = pd.read_csv(_TAX_DEPR) | ||
tax_deprec["Asset Type"] = tax_deprec["Asset Type"].str.strip() | ||
|
||
deprec_rates = tax_deprec.merge( | ||
econ_deprec_rates, | ||
how="left", | ||
left_on=["Asset Type"], | ||
right_on=["Asset"], | ||
copy=True, | ||
) | ||
|
||
return deprec_rates |