Python,Pandas:有效地计算4000个观测值的Spearman相关性

时间:2016-12-11 16:33:59

标签: python pandas correlation

我有一个包含2000行和4000列(观察)的DataFrame。我想逐行计算spearman相关性。目前我正在使用:

df.T.corr(method="spearman")

这似乎需要很长时间(20分钟但仍未完成)。

是否有更高效的模块?

我可以预处理DataFrame以加快速度吗?

更新:使用scipy.stats.spearmanr快20倍

SCC, pval = scp.spearmanr(df, axis=1)
SCC = pd.DataFrame(SCC, index=df.index, columns=df.index)

0 个答案:

没有答案