I would like to create a matrix of pairwise arrays from two arrays of different length, a and b:
a = np.array([1,2,3])
b = np.array([4,5,6,7])
So, c matrix should look like:
[[1,4], [1,5], [1,6], ..., [3,7]]
c = [[i,j] for i in (a) for j in (b)]
You can use np.meshgrid().
a = np.array((1, 2, 3))
b = np.array((4, 5, 6, 7))
out = np.stack([each.ravel(order='F') for each in np.meshgrid(a, b)])
out now looks like this:
array([[1, 4],
[1, 5],
[1, 6],
[1, 7],
[2, 4],
[2, 5],
[2, 6],
[2, 7],
[3, 4],
[3, 5],
[3, 6],
[3, 7]])
order='F'?
npobject?