text_plain_output_1.png
df_corr = df.corr()
N = 20
d = df_corr['CD53'].sort_values(ascending=False, key=abs).head(N).to_frame()
for t in df_corr['CD53'].sort_values(ascending=False, key=abs).index[:N]:
    m = (df[t] != 0) & (df['CD53'] != 0)
    c = np.corrcoef(df[t][m], df['CD53'][m])[0, 1]
    d.loc[t, 'Corr non zeros'] = c
d