вы можете использовать itertools.combination :
import numpy as np
from scipy import stats
from itertools import combinations
a = np.random.randint(10, size=100)
b = np.random.randint(10, size=160)
c = np.random.randint(10, size=100)
d = np.random.randint(10, size=100)
e = np.random.randint(10, size=100)
f = np.random.randint(10, size=200)
lst = [a,b,c,d,e,f]
for a, b in combinations(lst, 2):
y = stats.ttest_ind(a, b)
print(y)
вывод:
Ttest_indResult(statistic=0.46247644173232866, pvalue=0.6441294820185715)
Ttest_indResult(statistic=0.17563147927540387, pvalue=0.860762956033551)
Ttest_indResult(statistic=-0.33956487021286375, pvalue=0.734544144812151)
Ttest_indResult(statistic=-1.2585996515796976, pvalue=0.20965695759988032)
Ttest_indResult(statistic=-0.9744087042664061, pvalue=0.3306439429398049)
Ttest_indResult(statistic=-0.2621704529326102, pvalue=0.7933992339288952)
Ttest_indResult(statistic=-0.8308928812635019, pvalue=0.4068024085647085)
Ttest_indResult(statistic=-1.8196405842015377, pvalue=0.06997263551994957)
Ttest_indResult(statistic=-1.656013804568858, pvalue=0.09859522863276068)
Ttest_indResult(statistic=-0.5072111355359248, pvalue=0.6125711290632538)
Ttest_indResult(statistic=-1.3940088200942784, pvalue=0.16487737665085497)
Ttest_indResult(statistic=-1.1564852841741282, pvalue=0.24840897264283004)
Ttest_indResult(statistic=-0.9475505414697507, pvalue=0.3445133223584802)
Ttest_indResult(statistic=-0.6005599178585648, pvalue=0.5485896041348182)
Ttest_indResult(statistic=0.4943757206583791, pvalue=0.6214050963550106)
или вы можете использовать:
for i in range(len(lst)):
for j in range(i + 1, len(lst)):
y = stats.ttest_ind(lst[i], lst[j])
print(y)