Skip to content
CampusEduX

Problem 1: Compute and Display a Correlation Matrix

Easypython
Learn the Concept: Feature Selection

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().

Related Problems

  • Problem 2: Identify Features Most Correlated with the Target
    Easy · python
    Solve Problem
  • Problem 3: Remove Low-Variance Features
    Easy · python
    Solve Problem
  • Problem 4: Drop One of Two Highly Correlated Features
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...