Skip to content
C

Problem 1: Compute and Display a Correlation Matrix

Easypython

Problem Description

Write a Python program that takes a DataFrame with at least 3 numeric columns and prints the full correlation matrix.

Input

A DataFrame with at least 3 numeric columns.

Output

The correlation matrix.

Constraints

  • All columns must be numeric.

Example Input

text
{"a": [1,2,3,4], "b": [2,4,6,8], "c": [10,1,7,3]}

Example Output

text
(A 3x3 correlation matrix showing correlation coefficients between a, b, and c)

Concepts Covered

df.corr().

Input (stdin)

Output

Run your code to see output here...