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


Python Policy.expand_1D方法代码示例

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


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

示例1: test_expand_1D_variable_rates

# 需要导入模块: from taxcalc import Policy [as 别名]
# 或者: from taxcalc.Policy import expand_1D [as 别名]
def test_expand_1D_variable_rates():
    x = np.array([4, 5, 9], dtype="f4")
    irates = [0.02, 0.02, 0.03, 0.035]
    exp2 = []
    cur = 9.0
    exp = np.array([4, 5, 9, 9 * 1.03, 9 * 1.03 * 1.035])
    res = Policy.expand_1D(x, inflate=True, inflation_rates=irates, num_years=5)
    npt.assert_allclose(exp.astype("f4", casting="unsafe"), res)
开发者ID:codykallen,项目名称:Tax-Calculator,代码行数:10,代码来源:test_utils.py

示例2: test_expand_1D_variable_rates

# 需要导入模块: from taxcalc import Policy [as 别名]
# 或者: from taxcalc.Policy import expand_1D [as 别名]
def test_expand_1D_variable_rates():
    x = np.array([4, 5, 9], dtype='f4')
    irates = [0.02, 0.02, 0.03, 0.035]
    exp2 = []
    cur = 9.0
    exp = np.array([4, 5, 9, 9 * 1.03, 9 * 1.03 * 1.035])
    res = Policy.expand_1D(x, inflate=True, inflation_rates=irates,
                           num_years=5)
    assert np.allclose(exp.astype('f4', casting='unsafe'), res)
开发者ID:chun1211,项目名称:Tax-Calculator,代码行数:11,代码来源:test_utils.py

示例3: test_expand_1D_short_array

# 需要导入模块: from taxcalc import Policy [as 别名]
# 或者: from taxcalc.Policy import expand_1D [as 别名]
def test_expand_1D_short_array():
    x = np.array([4, 5, 9], dtype="i4")
    exp2 = np.array([9.0 * math.pow(1.02, i) for i in range(1, 8)])
    exp1 = np.array([4, 5, 9])
    exp = np.zeros(10)
    exp[:3] = exp1
    exp[3:] = exp2
    res = Policy.expand_1D(x, inflate=True, inflation_rates=[0.02] * 10, num_years=10)
    npt.assert_allclose(exp, res, atol=0.0, rtol=1.0e-7)
开发者ID:codykallen,项目名称:Tax-Calculator,代码行数:11,代码来源:test_utils.py

示例4: test_expand_1D_short_array

# 需要导入模块: from taxcalc import Policy [as 别名]
# 或者: from taxcalc.Policy import expand_1D [as 别名]
def test_expand_1D_short_array():
    x = np.array([4, 5, 9], dtype='i4')
    exp2 = np.array([9.0 * math.pow(1.02, i) for i in range(1, 8)])
    exp1 = np.array([4, 5, 9])
    exp = np.zeros(10)
    exp[:3] = exp1
    exp[3:] = exp2
    res = Policy.expand_1D(x, inflate=True, inflation_rates=[0.02] * 10,
                           num_years=10)
    assert np.allclose(exp.astype(x.dtype, casting='unsafe'), res)
开发者ID:chun1211,项目名称:Tax-Calculator,代码行数:12,代码来源:test_utils.py

示例5: test_expand_1D_scalar

# 需要导入模块: from taxcalc import Policy [as 别名]
# 或者: from taxcalc.Policy import expand_1D [as 别名]
def test_expand_1D_scalar():
    x = 10.0
    exp = np.array([10.0 * math.pow(1.02, i) for i in range(0, 10)])
    res = Policy.expand_1D(x, inflate=True, inflation_rates=[0.02] * 10,
                           num_years=10)
    assert np.allclose(exp, res)
开发者ID:chun1211,项目名称:Tax-Calculator,代码行数:8,代码来源:test_utils.py


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