Skip to content

Commit

Permalink
Merge pull request #142 from PeterDSteinberg/fix-conda-recipe-b
Browse files Browse the repository at this point in the history
Fixes to conda.recipe
  • Loading branch information
jdebacker committed Mar 17, 2017
2 parents 722c50f + 2f27e51 commit 1458a6c
Show file tree
Hide file tree
Showing 25 changed files with 151 additions and 109 deletions.
5 changes: 0 additions & 5 deletions Python/conda.recipe/bld.bat

This file was deleted.

10 changes: 0 additions & 10 deletions Python/conda.recipe/build.sh

This file was deleted.

28 changes: 0 additions & 28 deletions Python/conda.recipe/meta.yaml

This file was deleted.

1 change: 0 additions & 1 deletion Python/conda.recipe/run_test.py

This file was deleted.

4 changes: 2 additions & 2 deletions btax/btax_reform_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-------------------------------------------------------------------------------
"""
# Import packages
from btax.run_btax import run_btax, run_btax_with_baseline_delta, run_btax_to_json_tables
from btax.run_btax import run_btax, run_btax_with_baseline_delta

test_run = False # flag for test run (for Travis CI)
start_year = 2016
Expand All @@ -15,7 +15,7 @@
# btax_depr_5yr_exp=40.,btax_depr_7yr_exp=40.,btax_depr_10yr_exp=40.,
# btax_depr_15yr_exp=40.,btax_depr_20yr_exp=40.)
#2019 law
run_btax_to_json_tables(test_run,start_year,iit_reform,btax_depr_3yr_exp=30.,
run_btax_with_baseline_delta(test_run,start_year,iit_reform,btax_depr_3yr_exp=30.,
btax_depr_5yr_exp=30.,btax_depr_7yr_exp=30.,btax_depr_10yr_exp=30.,
btax_depr_15yr_exp=30.,btax_depr_20yr_exp=30.)
#2020 law
Expand Down
2 changes: 1 addition & 1 deletion btax/calc_final_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import sys
import pandas as pd
import numpy as np
import parameters as param
import btax.parameters as param
from btax.util import get_paths

globals().update(get_paths())
Expand Down
27 changes: 14 additions & 13 deletions btax/check_asset_alloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Last updated 10/05/2016
"""
# Packages:
from __future__ import print_function
import os.path
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -113,8 +114,8 @@

# compute value of land for owner occupied housing sector
owner_occ_house_land = owner_occ_house_RE - owner_occ_house_FA
print 'Owner Occ housing land: ', owner_occ_house_land
print 'Owner Occ housing FAs: ', owner_occ_house_FA
print('Owner Occ housing land: ', owner_occ_house_land)
print('Owner Occ housing FAs: ', owner_occ_house_FA)
# update amout of land for non-corporate sector
noncorp_land -= owner_occ_house_land

Expand All @@ -128,22 +129,22 @@
total_btax_INV = asset_data.loc[asset_data['Asset Type']=='Inventories','assets'].sum()
total_btax_RES_FA = asset_data.loc[asset_data['Asset Type']=='Residential','assets'].sum()
total_btax_FA = total_btax_assets - total_btax_LAND - total_btax_INV - total_btax_RES_FA
print 'diff in FA: ', total_btax_RES_FA-total_bea_RES_FA
print('diff in FA: ', total_btax_RES_FA-total_bea_RES_FA)


'''
Print percentage differences between control totals and BTax data
'''
print 'Diff in Non-residential Fixed Assets: ', (total_btax_FA-total_bea_FA)/total_bea_FA
print 'Diff in Land: ', (total_btax_LAND-total_finacct_LAND)/total_finacct_LAND
print 'Diff in Inventories: ', (total_btax_INV-total_bea_INV)/total_bea_INV
print 'Diff in Residential Fixed Assets: ', (total_btax_RES_FA-total_bea_RES_FA)/total_bea_RES_FA

print "amount non-res fixed assets: ", total_btax_FA
print "amount of land: ", total_btax_LAND
print "amount of inventories: ", total_btax_INV
print "amount of res fixed assets: ", total_btax_RES_FA
print "diff in res fixed assets: ", total_btax_RES_FA-total_bea_RES_FA
print('Diff in Non-residential Fixed Assets: ', (total_btax_FA-total_bea_FA)/total_bea_FA)
print('Diff in Land: ', (total_btax_LAND-total_finacct_LAND)/total_finacct_LAND)
print('Diff in Inventories: ', (total_btax_INV-total_bea_INV)/total_bea_INV)
print('Diff in Residential Fixed Assets: ', (total_btax_RES_FA-total_bea_RES_FA)/total_bea_RES_FA)

print("amount non-res fixed assets: ", total_btax_FA)
print("amount of land: ", total_btax_LAND)
print("amount of inventories: ", total_btax_INV)
print("amount of res fixed assets: ", total_btax_RES_FA)
print("diff in res fixed assets: ", total_btax_RES_FA-total_bea_RES_FA)
'''
Do differences in fixed assets by industry (the place where BEA data has detail)
'''
Expand Down
9 changes: 7 additions & 2 deletions btax/check_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
"""

import os.path
import cPickle as pickle
try:
import cPickle as pickle
except ImportError:
import pickle

import pandas as pd
from util import get_paths

from btax.util import get_paths

globals().update(get_paths())

Expand Down
5 changes: 4 additions & 1 deletion btax/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
# Import packages
from __future__ import unicode_literals
from collections import namedtuple, defaultdict
import cPickle as pickle
try:
import cPickle as pickle
except ImportError:
import pickle
from functools import partial
import numpy as np
import os.path
Expand Down
7 changes: 5 additions & 2 deletions btax/format_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import sys
import pandas as pd
import numpy as np
import cPickle as pickle
from util import get_paths, read_from_egg
try:
import cPickle as pickle
except ImportError:
import pickle
from btax.util import get_paths, read_from_egg


globals().update(get_paths())
Expand Down
1 change: 1 addition & 0 deletions btax/front_end_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
from collections import defaultdict
import os

from btax.parameters import DEFAULT_ASSET_COLS, DEFAULT_INDUSTRY_COLS

# Row labels, in order, including minor headings like "Durable goods"
Expand Down
15 changes: 8 additions & 7 deletions btax/get_taxcalc_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@
------------------------------------------------------------------------
'''
from __future__ import print_function
import copy

import taxcalc
from taxcalc import *
import pandas as pd
from pandas import DataFrame
import numpy as np
import copy
import numba
import numpy as np
import pandas as pd
import pickle
import taxcalc

from taxcalc import *

def get_calculator(baseline, calculator_start_year, reform=None, data=None,
weights=None, records_start_year=None):
weights=None, records_start_year=None):
'''
--------------------------------------------------------------------
This function creates the tax calculator object for the microsim
Expand Down Expand Up @@ -172,5 +173,5 @@ def get_rates(baseline=False, start_year=2017, reform={}):
individual_rates = {'tau_nc':tau_nc,'tau_div':tau_div,'tau_int':tau_int,
'tau_scg':tau_scg,'tau_lcg':tau_lcg,'tau_td':tau_td,
'tau_h':tau_h}
print individual_rates
print(individual_rates)
return individual_rates
8 changes: 4 additions & 4 deletions btax/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import copy
import json
import os
import pandas as pd

import numpy as np
import pandas as pd

# from btax.util import read_from_egg, DEFAULT_START_YEAR
from util import read_from_egg, DEFAULT_START_YEAR
from btax.util import read_from_egg, DEFAULT_START_YEAR

PARAMETER_START_YEAR = 2015 # first year for with tax parameters identified in btax_defaults.json
DEFAULTS = json.loads(read_from_egg(os.path.join('param_defaults', 'btax_defaults.json')))
Expand Down Expand Up @@ -45,7 +45,7 @@ def translate_param_names(start_year=DEFAULT_START_YEAR,**user_mods):
state = 'Economic'
user_deprec_system[cl] = state

user_mods.update({k: v['value'][year] for k,v in defaults.iteritems()
user_mods.update({k: v['value'][year] for k,v in defaults.items()
if k not in user_mods})

user_bonus_deprec = {cl: user_mods['btax_depr_{}yr_exp'.format(cl)]/100.
Expand Down
12 changes: 7 additions & 5 deletions btax/pull_soi_corp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"""
# Packages:
from __future__ import print_function
import os.path

import numpy as np
import pandas as pd
# Directory names:
Expand Down Expand Up @@ -54,7 +56,7 @@ def load_corp_data():
# put in dollars (data in 1000s)
s_corp[columns]=s_corp[columns]*_CORP_FILE_FCTR
except IOError:
print "IOError: S-Corp soi data file not found."
print("IOError: S-Corp soi data file not found.")
raise
# Opening the soi Total-corporate data file:
try:
Expand All @@ -66,7 +68,7 @@ def load_corp_data():
# put in dollars (data in 1000s)
tot_corp[columns]=tot_corp[columns]*_CORP_FILE_FCTR
except IOError:
print "IOError: total corp soi data file not found."
print("IOError: total corp soi data file not found.")
raise

# read in crosswalk for bea and soi industry codes
Expand Down Expand Up @@ -99,8 +101,8 @@ def load_corp_data():
c_corp[var] = c_corp[var+'_x']-c_corp[var+'_y']

# clean up data by dropping and renaming columns
c_corp.drop(map(lambda (x,y): x+y, zip(columns, ['_x']*len(columns))), axis=1, inplace=True)
c_corp.drop(map(lambda (x,y): x+y, zip(columns, ['_y']*len(columns))), axis=1, inplace=True)
c_corp.drop(map(lambda x,y: x+y, zip(columns, ['_x']*len(columns))), axis=1, inplace=True)
c_corp.drop(map(lambda x,y: x+y, zip(columns, ['_y']*len(columns))), axis=1, inplace=True)

## NOTE:
# totals in s_corp match totals in SOI data
Expand Down Expand Up @@ -157,7 +159,7 @@ def calc_proportions(tot_corp, s_corp, columns):

# clean up data by dropping and renaming columns
s_corp.drop(['INDY_CD_y','_merge','sector_code']+columns, axis=1, inplace=True)
s_corp.drop(map(lambda (x,y): x+y, zip(columns, ['_ratio']*len(columns))), axis=1, inplace=True)
s_corp.drop(map(lambda x,y: x+y, zip(columns, ['_ratio']*len(columns))), axis=1, inplace=True)
s_corp.rename(columns={"INDY_CD_x": "INDY_CD"},inplace=True)
s_corp.columns = s_corp.columns.str.replace('_final', '')

Expand Down
6 changes: 3 additions & 3 deletions btax/pull_soi_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"""
# Packages:
import os.path
import re

import numpy as np
import pandas as pd
import xlrd
import re


from btax.util import get_paths
globals().update(get_paths())
Expand Down Expand Up @@ -151,7 +151,7 @@ def load_partner_data(entity_dfs):
#part_data.ix[part_data['minor_code_alt']>99999, var+'_ratio'] = 1.
part_data[var] = part_data[var]*part_data[var+'_ratio']

part_data.drop(map(lambda (x,y): x+y, zip(columns, ['_ratio']*len(columns))), axis=1, inplace=True)
part_data.drop(map(lambda x,y: x+y, zip(columns, ['_ratio']*len(columns))), axis=1, inplace=True)
part_data.drop(['index','sector_code','major_code_x','minor_code',
'INDY_CD','major_code_y'],axis=1,inplace=True)

Expand Down
5 changes: 3 additions & 2 deletions btax/pull_soi_proprietorship.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
"""

import os.path
import re
import sys

import numpy as np
import pandas as pd
import re

from btax.util import get_paths
import btax.pull_soi_partner as prt
Expand Down Expand Up @@ -154,7 +155,7 @@ def load_proprietorship_data(entity_dfs):
nonfarm.ix[nonfarm['INDY_CD']>99999, var+'_ratio'] = 1.
nonfarm[var] = nonfarm[var]*nonfarm[var+'_ratio']

nonfarm.drop(map(lambda (x,y): x+y, zip(columns, ['_ratio']*len(columns))), axis=1, inplace=True)
nonfarm.drop(map(lambda x,y: x+y, zip(columns, ['_ratio']*len(columns))), axis=1, inplace=True)
nonfarm.drop(['index','sector_code','major_code_x','minor_code',
'major_code_y','_merge'],axis=1,inplace=True)

Expand Down
4 changes: 3 additions & 1 deletion btax/read_bea.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
"""
# Packages:
import os.path
import pickle

import numpy as np
import pandas as pd
import xlrd
import pickle

from btax.util import get_paths

# Directories:
Expand Down
10 changes: 7 additions & 3 deletions btax/run_btax.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
# Import packages
from __future__ import unicode_literals
from collections import namedtuple, defaultdict
import cPickle as pickle
try:
import cPickle as pickle
except ImportError:
import pickle
from functools import partial
import numpy as np
import os.path
import pandas as pd
import sys

import numpy as np
import pandas as pd

from btax.soi_processing import pull_soi_data
from btax import calc_final_outputs
from btax import check_output
Expand Down
1 change: 1 addition & 0 deletions btax/soi_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# Import packages
import os.path
import sys

import numpy as np
import pandas as pd
# Import custom modules
Expand Down

0 comments on commit 1458a6c

Please sign in to comment.