text_html_output_1.png text_plain_output_1.png
from scipy import stats
d1_corr = pd.DataFrame(index=df.columns)
res = stats.pearsonr([1, 2, 3, 4, 5], [10, 9, 2.5, 6, 4])
col1 = 'CD45RA'
for col in df.columns:
    v0 = df[col]
    v1 = df_Y[col1]
    res = stats.pearsonr(v0, v1)
    d1_corr.loc[col, 'Corr ' + col1] = res[0]
    d1_corr.loc[col, 'pvalue ' + col1] = res[1]
d1_corr.to_csv()
m = d1_corr[d1_corr.columns[1]] < 0.05 / len(d1_corr)
print(m.sum())
display(d1_corr[m].sort_values(d1_corr.columns[0], ascending=False, key=abs))
d1_corr.sort_values(d1_corr.columns[0], ascending=False, key=abs)