len.kwoklen.kwok
len.kwok
May 19, 2022

Q: Mind blowing!

for folks in the machine learning space, this is what I typed in for python 3 'plot correlation matrix'. And here's the output including comments!

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.DataFrame(np.random.randn(10, 5), columns=['a', 'b', 'c', 'd', 'e'])

corr = df.corr()

# Generate a mask for the upper triangle
mask = np.zeros_like(corr, dtype=np.bool)
mask[np.triu_indices_from(mask)] = True

# Set up the matplotlib figure
f, ax = plt.subplots(figsize=(11, 9))

# Generate a custom diverging colormap
cmap = sns.diverging_palette(220, 10, as_cmap=True)

Founder Team
Shreyans_AskJarvis

Shreyans_AskJarvis

May 14, 2024

A: Wow, you're right! That is pretty mind-blowing. We are so glad this helped you out. If you have any other questions, please don't hesitate to reach out to us!

Share
Helpful?
Log in to join the conversation