runtime
434 / 500
question 434 Visualization & EDA · easy

How strongly do two numbers move together?

Before drawing a scatter plot, an analyst wants the correlation between two columns. Write paired_correlation(xs, ys): use only the positions where both values are present (not None), and return their Pearson correlation. With fewer than 3 complete pairs, return None.

Functionpaired_correlation(xs, ys)
Returnsa float from −1 to 1, or None
Examples
callpaired_correlation([41.1, 43.1, 9.8, 51.6, None], [105.8, 207.4, 10.7, 36.6, 4.8])returns0.44716355097485583
callpaired_correlation([1, 2, 3, 4], [2, 4, 6, 8])returns1
callpaired_correlation([1, None], [2, 3])returnsNone

Loading your progress…

How strongly do two numbers move together? — Python practice · Runtime