I have a 2000 numpy arrays of size 7 x 11. The rows are arranged in the following order of variables: pi, Tajima's D, Theta, dust kurtosis, J1/J2, J1, J2. That is first row always corresponds to pi, second row corresponds to Tajima's D and so on.
What I want to do is shuffle the rows but also keeping track of in which row has that variable moved to. For example, Tajima's D, Theta, pi, distkurtosis, J1/J2, J1, J2. And I want to keep track that now pi is in row 3. How can I achieve that? Please note, I want to only move the rows and not the columns.
Also, is there a way to make all possible combinations while keeping track of where each variable has move to?
My apologies if it is a really basic question. But, I'm having a hard time finding a solution for this problem.
My code thus far:
def interchange(array, n, m):
rows = n
#print(array)
#print('\n')
# swapping of element
for i in range(m):
t = array[0][i]
array[0][i] = array[5][i]
array[5][i] = t
t = array[4][i]
array[0][i] = array[8][i]
array[8][i] = t
#print(array)
return array
###Calling the function
for i in range(2000):
h1[i] = interchange(h1[i], n, m)