I have a DataFrame with 2000 rows and 4000 columns (observations). I want to calculate the spearman correlation row-wise. Currently I´m using:
df.T.corr(method="spearman")
It seems to take a very long time (20min and still not finished).
Is there a more efficient module?
Can I preprocess the DataFrame to speed things up?
UPDATE: Using scipy.stats.spearmanr is 20x faster
SCC, pval = scp.spearmanr(df, axis=1)
SCC = pd.DataFrame(SCC, index=df.index, columns=df.index)