There are multiple questions based on this topic like -
Using numpy to build an array of all combinations of two arrays
Cartesian product of x and y array points into single array of 2D points but these are applicable to values inside arrays and not on the rows of arrays
but what i want is combination of rows in way like --- row0 to row 1 , row 0 to row 2 , 0 to 3, 0 to 4 then 1 to 2 , 1 to 3, 1 to 4 and so on
a=np.array([
[ 0. , 338.2 ],
[ 1. , 339.45],
[ 2. , 339.2 ],
[ 3. , 340.7 ],
[ 4. , 340.15]
])
output must be -
[ 0. 338.2] [ 1. 339.45]
[ 0. 338.2] [ 2. 339.2]
[ 0. 338.2] [ 3. 340.7]
[ 0. 338.2] [ 4. 340.15]
[ 1. 339.45] [ 2. 339.2]
[ 1. 339.45] [ 3. 340.7]
[ 1. 339.45] [ 4. 340.15]
[ 2. 339.2] [ 3. 340.7]
[ 2. 339.2] [ 4. 340.15]
[ 3. 340.7] [ 4. 340.15]
itertools.combinations works but it is really slow if size of array increases so looking for numpy approach