I have a 2 dimensional numpy array. I am trying to make pairs of each row with every other row.
For example:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
It should have the following pairs(comma separated):
Pair(1,2) 1 2 3 4 5, 6 7 8 9 10
Pair(1,3) 1 2 3 4 5, 11 12 13 14 15
Pair(2,1) 6 7 8 9 10, 1 2 3 4 5
Pair(2,3) 6 7 8 9 10, 11 12 13 14 15
Pair(3,1) 11 12 13 14 15, 1 2 3 4 5
Pair(3,2) 11 12 13 14 15, 6 7 8 9 10
To achieve this task, I am converting each row to string then removing multiple white spaces, end line chars and [ ] chars.
But when I use numpy.array_str() for converting a large array (1500*100) it converts the row to:
1 2 ...., 4 5, 6 7 ....,8 9
Why is this happening and how can I fix this problem such that it doesn't slows down my program? If there is no possible way to do this without compromising speed then how can I achieve this task?