【发布时间】:2020-09-07 20:43:47
【问题描述】:
我想把两个数组的元素加在一起,一个叫propensity shape = (4,) and length = 4 另一个叫state_change_lambda with shape (3,) and length 3。
但我想将state_change_lambda 的第一个元素添加到propensity 的第一个和第二个元素,然后像正常迭代一样继续添加元素。
类似:
propensity = np.array([1, 2, 3, 4,])
state_change_lambda = np.array([5, 6, 7])
[out]: new_array_after_addition = ([6, 7, 9, 11]) <-- five has been added to both element 1 and 2 of propensity
只是我不太确定如何在 python 中执行此操作,我已经查看了enumerate,但我不确定这是完全正确的使用方法
干杯
【问题讨论】: