t test on Pandas dataframes and make a new matrix of resulting p values

Viewed 4974

I have 3 dataframes containing 7 columns.

df_a
df_b
df_c
df_a.head()

  VSPD1_perc  VSPD2_perc  VSPD3_perc  VSPD4_perc  VSPD5_perc  VSPD6_perc  \
0          NaN         NaN         NaN         NaN         NaN         NaN   
3     0.189588    0.228052    0.268460    0.304063    0.009837           0   
5     0.134684    0.242556    0.449054    0.168816    0.004890           0   
9     0.174806    0.232150    0.381936    0.211108    0.000000           0   
11         NaN         NaN         NaN         NaN         NaN         NaN   

    VSPD7_perc  
0          NaN  
3            0  
5            0  
9            0  
11         NaN 

My goal is to produce a matrix or a dataframe with the resulting p values from a t-test, and test dataframes df_b and df_c against df_a, column for column. That is test column 1 in df_b and df_c against column 1 in df_a. I would like to use dataframe (df_a) as a standard to make a statistical t test against. I have found the statistical test in statsmodels (stat.ttest_ind(x1, x2)), but I need help on making a matrix out of the p values from the test. Does anyone know how to do this...

1 Answers
Related