当前位置: 首页>>代码示例>>Python>>正文


Python Calculator.current_law_version方法代码示例

本文整理汇总了Python中taxcalc.Calculator.current_law_version方法的典型用法代码示例。如果您正苦于以下问题:Python Calculator.current_law_version方法的具体用法?Python Calculator.current_law_version怎么用?Python Calculator.current_law_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在taxcalc.Calculator的用法示例。


在下文中一共展示了Calculator.current_law_version方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_Calculator_current_law_version

# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import current_law_version [as 别名]
def test_Calculator_current_law_version(records_2009):
    policy = Policy()
    reform = {2013: {'_II_rt7': [0.45]}}
    policy.implement_reform(reform)
    calc = Calculator(policy=policy, records=records_2009)
    calc_clp = calc.current_law_version()
    assert isinstance(calc_clp, Calculator)
    assert calc.policy.II_rt6 == calc_clp.policy.II_rt6
    assert calc.policy.II_rt7 != calc_clp.policy.II_rt7
开发者ID:kerkphil,项目名称:Tax-Calculator,代码行数:11,代码来源:test_calculate.py

示例2: test_multiyear_diagnostic_table_w_behv

# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import current_law_version [as 别名]
def test_multiyear_diagnostic_table_w_behv(records_2009):
    pol = Policy()
    behv = Behavior()
    calc = Calculator(policy=pol, records=records_2009, behavior=behv)
    assert calc.current_year == 2013
    reform = {2013: {"_II_rt7": [0.33], "_PT_rt7": [0.33]}}
    pol.implement_reform(reform)
    reform_be = {2013: {"_BE_sub": [0.4], "_BE_cg": [-3.67]}}
    behv.update_behavior(reform_be)
    calc_clp = calc.current_law_version()
    calc_behv = Behavior.response(calc_clp, calc)
    calc_behv.calc_all()
    liabilities_x = (calc_behv.records._combined * calc_behv.records.s006).sum()
    adt = multiyear_diagnostic_table(calc_behv, 1)
    # extract combined liabilities as a float and
    # adopt units of the raw calculator data in liabilities_x
    liabilities_y = adt.iloc[18].tolist()[0] * 1000000000
    npt.assert_almost_equal(liabilities_x, liabilities_y, 2)
开发者ID:codykallen,项目名称:Tax-Calculator,代码行数:20,代码来源:test_utils.py

示例3: Records

# 需要导入模块: from taxcalc import Calculator [as 别名]
# 或者: from taxcalc.Calculator import current_law_version [as 别名]
    rec2 = Records(data=PUF_DATA)
    calc2 = Calculator(policy=pol2, records=rec2, verbose=False, behavior=beh2)
    output_type = REFORMS_JSON.get(this_reform).get("output_type")
    reform_name = REFORMS_JSON.get(this_reform).get("name")

    # increment both calculators to reform's start_year
    calc1.advance_to_year(start_year)
    calc2.advance_to_year(start_year)

    # calculate prereform and postreform for num_years
    reform_results = []
    for _ in range(0, NUM_YEARS):
        calc1.calc_all()
        prereform = getattr(calc1.records, output_type)
        if calc2.behavior.has_response():
            calc_clp = calc2.current_law_version()
            calc2_br = Behavior.response(calc_clp, calc2)
            postreform = getattr(calc2_br.records, output_type)
        else:
            calc2.calc_all()
            postreform = getattr(calc2.records, output_type)
        diff = postreform - prereform
        weighted_sum_diff = (diff * calc1.records.s006).sum() * 1.0e-9
        reform_results.append(weighted_sum_diff)
        calc1.increment_year()
        calc2.increment_year()

    # put reform_results in the dictionary of all results
    RESULTS[reform_name] = reform_results

# write RESULTS to text file
开发者ID:salimfurth,项目名称:Tax-Calculator,代码行数:33,代码来源:reform_results.py


注:本文中的taxcalc.Calculator.current_law_version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。