本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)