Consider two 2d arrays, A and B.
import numpy as np
A = np.array([[1, 4],
[3, 5],
[1, 2]])
B = np.array([[2, 3],
[1, 3]])
I want to build an array arrOut that gives all combinations of the rows of A and the rows of B in a 4-column array.
The desired output is:
arrOut = [[1, 4, 2, 3],
[1, 4, 1, 3],
[3, 5, 2, 3],
[3, 5, 1, 3],
[1, 2, 2, 3],
[1, 2, 1, 3]]
I'm hoping to see a solution that could be readily expanded to all combinations of the rows of three 2d arrays to form a six column array, or all combinations of the rows of four 2d arrays to form an 8 column array.