Running Kruskal-Wallis/ANOVA over multiple columns

301 views Asked by At

I am trying to do kruskal-wallis in a dataframe. In rows- I have 4 groups of data (4 disease diagnosis), each of the group has 6 patients each In columns- I have around 7000 genes.

I am trying to perform kruskal-wallis/ANOVA amoung the 4 groups for each gene.

I am able to do it by this code- stats.kruskal(*[group["gene_1"].values for name, group in df.groupby("disease_diagnosis")])

This gives the p-value for gene 1

I am trying to get this done over the 7000 genes (in columns) I tried this code.

for key, value in df.iteritems():
       kw_table = stats.kruskal(*[value.values for name, group in 
df.groupby("disease_diagnosis")])
print(kw_table) 

this did not work among others I tried. Will be helpful to get some guidance.. thanks

0

There are 0 answers