Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Computes per-feature pairwise NaN-safe Spearman and Pearson correlations for large feature sets, filtering degenerate inputs.
43% 87%+43 ptsof test cases passed
Passed 20 of 23 test cases with the skill, and 10 of 23 without it.
3 of 3 safety checks passed
Not used yet
Computing correlations across many features (genes, proteins, variants) when missing values are present is error-prone. The most common mistake is using bulk matrix shortcuts that silently mishandle NaN, producing incorrect correlation values. This guide covers correct per-feature pairwise computation, degenerate input filtering, and performance optimization.
Different features have different missing value patterns across samples. Bulk methods handle this inconsistently:
| Method | Problem |
|---|---|
DataFrame.rank() then corrwith() | rank() assigns NaN ranks; corrwith() may drop globally or per-column inconsistently |
DataFrame.corrwith(method='spearman') | Implementation varies by pandas version; may use listwise deletion |
np.corrcoef on ranked data | Propagates NaN to entire result if any value is missing |
Features that produce undefined or unstable correlations:
| Type | Description | Effect |
|---|---|---|
| Constant features | All values identical (variance = 0) | Correlation undefined (division by zero) |
| Near-constant features | Very low variance | Correlation numerically unstable |
| Too few valid values | After NaN removal, fewer than min_valid pairs | Statistically unreliable |
| Single-value after filtering | Only one unique value remains post-NaN removal | Correlation undefined |
Next to this one in the catalogue, plus more from the same author.