如何获取行位置数组和列位置数组并创建组合点的新数组?

时间:2017-09-18 13:45:38

标签: python numpy

我想采用1x3矩阵的'行'值,其中a =([1],[3],[5])和3x1列值矩阵,b =([1,4, 7]),并创建(行,列)值的3x3矩阵,以便最终矩阵看起来像

([(1,1)(1,4)(1,7)],

[(3,1)(3,4)(3,7)],

[(5,1)(5,4)(5,7)])

有没有办法在不使用for循环的情况下执行此操作?

import numpy as np
a = np.array([1,4,7]).reshape((3,1))
b = np.array([1,3,5]).reshape((1,3))

0 个答案:

没有答案