pathway=(list(set(genes.iloc[0]).intersection(genes.iloc[i+1]))),(list(set(genes.iloc1).intersection(genes.iloc[i+2]))),(list(set(genes.iloc[2]).intersection(genes.iloc[i+3]))),(list(set(genes.iloc[3]).intersection(genes.iloc[i+4])
Instead of writing 0,1,2 to specify indeces, Is there any way to loop through the index?
I have 90 columns in genes dataframe, so kindly help me to make it simple.
Example: genes =
I want to compare 1st row with 2,3,4,5,6,7,8. Then 2nd row with 3,4,5,6,7,8 and so on till 7th row to 8.
I have tried this code,
for i in range(len(keys)):
for k in range (0,8):
for h in range (1,9):
pathway1=(list(set(genes.iloc[k]).intersection(genes.iloc[i+h])))
print(pathway1)
But its give me only 1st row with 2,3,4,5,6,7,8 comparison not others