📜  求和每个第 i 个元素 numpy - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:41.594000             🧑  作者: Mango

代码示例1
import numpy as np
c = [1, 0, 0, 0, 0, 2, 0, 0, 0, 0]
np.add.reduceat(c, np.arange(0, len(c), 5))
# array([1, 2])