stats.correlations¶
correlations ¶
correlations(data: DataInput | DataSource, *, columns=None, method: Literal['pearson', 'spearman'] = 'pearson', max_columns: int = 20) -> pl.DataFrame
Pairwise numeric correlations in tidy form (opt-in; never in quick mode).
Null, NaN, and infinite observations are excluded pairwise. Correlations with fewer than two valid paired values return null. This can require O(number of variable pairs) scans and is intentionally bounded.
Example¶
table = ps.stats.correlations(df, columns=['age', 'baseline_score'], method='spearman')
Research note¶
Correlations are descriptive associations, not evidence of causation.