小编Che*_*ong的帖子

为数组python中的每个元素添加值

我有这样的数组

a= np.arange(4).reshape(2,2)

array([[0, 1],[2, 3]])
Run Code Online (Sandbox Code Playgroud)

我想为数组中的每个元素添加一个值.我希望我的结果返回4个数组

array([[1, 1],[2, 3]])

array([[0, 2],[2, 3]])

array([[0, 1],[3, 3]])

array([[0, 1],[2, 4]])
Run Code Online (Sandbox Code Playgroud)

python numpy python-2.7

6
推荐指数
1
解决办法
1225
查看次数

标签 统计

numpy ×1

python ×1

python-2.7 ×1