You can use libraries like Matplotlib and Seaborn to create a heatmap visualization of the correlation matrix.
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Create a sample DataFrame
data = {'A': [1, 2, 3, 4, 5],
'B': [5, 4, 3, 2, 1],
'C': [2, 3, 1, 4, 5]}
df = pd.DataFrame(data)
# Calculate the correlation matrix
correlation_matrix = df.corr()
# Create a heatmap
plt.figure(figsize=(8, 6))
sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm', linewidths=0.5)
plt.show()