0
0
Data Analysis Pythondata~10 mins

Heatmaps for correlation in Data Analysis Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to calculate the correlation matrix of the DataFrame df.

Data Analysis Python
corr_matrix = df.[1]()
Drag options to blanks, or click blank then click option'
Asum
Bmean
Ccorr
Ddescribe
Attempts:
3 left
💡 Hint
Common Mistakes
Using mean() or sum() instead of corr().
Trying to use describe() which gives summary statistics, not correlation.
2fill in blank
medium

Complete the code to import the seaborn library with its common alias.

Data Analysis Python
import [1] as sns
Drag options to blanks, or click blank then click option'
Aseaborn
Bmatplotlib
Cpandas
Dnumpy
Attempts:
3 left
💡 Hint
Common Mistakes
Importing matplotlib or pandas instead of seaborn.
Not using the alias sns.
3fill in blank
hard

Fix the error in the code to create a heatmap of the correlation matrix corr_matrix.

Data Analysis Python
sns.heatmap([1], annot=True, cmap='coolwarm')
Drag options to blanks, or click blank then click option'
Adf
Bcorr_matrix
Cdata
Dplt
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the original DataFrame instead of the correlation matrix.
Passing matplotlib or unrelated variables.
4fill in blank
hard

Fill both blanks to create a heatmap with a title and show the plot.

Data Analysis Python
sns.heatmap(corr_matrix, annot=True, cmap=[1])
plt.[2]()
Drag options to blanks, or click blank then click option'
A'viridis'
Bshow
C'coolwarm'
Dplot
Attempts:
3 left
💡 Hint
Common Mistakes
Using an unrelated color map.
Forgetting to call plt.show().
5fill in blank
hard

Fill all three blanks to import matplotlib, set figure size, and create a heatmap with annotations.

Data Analysis Python
import [1] as plt
plt.figure(figsize=([2], 6))
sns.heatmap(corr_matrix, annot=[3], cmap='coolwarm')
Drag options to blanks, or click blank then click option'
Amatplotlib.pyplot
B10
CTrue
Dseaborn
Attempts:
3 left
💡 Hint
Common Mistakes
Importing seaborn as plt.
Setting figure size with wrong values.
Not enabling annotations.