Skip to content
CampusEduX

Problem 2: Visualize a Correlation Matrix as a Heatmap

Easypython
Learn the Concept: Seaborn

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.

Related Problems

  • Problem 1: Create a Boxplot Grouped by Category
    Easy · python
    Solve Problem
  • Problem 3: Create a Scatter Plot with Categorical Coloring
    Easy · python
    Solve Problem
  • Problem 4: Check Class Balance with a Count Plot
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...