All problems

Building a Custom Grid With PairGrid

hardPythonSeabornPairGrid

Thornbury Labs wants one page that shows the same two measurements three ways: raw points above the diagonal, a smoothed density below it, and each measurement's own spread along it. That page is assembled panel region by panel region rather than in one go. Alongside it the report states, in writing, how tightly a and b move together.

Task: Print the correlation between the a column and the b column.

Input

The first line holds one integer n, the number of samples, where 2 <= n <= 1000. Then come n lines, each holding a sample's a and b separated by a single space. Neither column is the same value on every sample.

Output

One line holding the Pearson correlation of a and b -- the ordinary straight-line one, running from -1 for a perfect fall through 0 for no straight-line link to +1 for a perfect rise -- rounded to 2 decimal places.

Example:

Input:
4
1 10
2 20
3 30
4 40

Output:
1.00

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…