Skip to content
C

Problem 2: Visualize a Correlation Matrix as a Heatmap

Easypython

Problem Description

Write a Python program that calculates the correlation matrix of a DataFrame's numeric columns and visualizes it using sns.heatmap() with annotated values.

Input

A DataFrame with at least 3 numeric columns.

Output

A displayed, annotated correlation heatmap.

Constraints

  • At least 3 numeric columns.

Example Input

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

Example Output

text
(An annotated heatmap showing correlation values between a, b, and c)

Concepts Covered

sns.heatmap(), .corr(), annot=True.

Input (stdin)

Output

Run your code to see output here...