Complete the code to import the matplotlib library for plotting.
import [1] as plt
We import matplotlib.pyplot as plt to create plots.
Complete the code to calculate the correlation matrix from the DataFrame 'df'.
corr_matrix = df.[1]()cov() which calculates covariance, not correlation.mean() or sum().The corr() method calculates the correlation matrix of a DataFrame.
Fix the error in the code to display the correlation matrix as a heatmap using matplotlib.
plt.imshow(corr_matrix, cmap=[1])
plt.colorbar()
plt.show()The colormap name must be a string, so it needs quotes like 'coolwarm'.
Fill both blanks to create a dictionary comprehension that maps each word to its length only if the length is greater than 3.
lengths = {word: [1] for word in words if [2]The dictionary comprehension maps each word to its length using len(word). The condition filters words with length greater than 3 using len(word) > 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase keys to values only if the value is positive.
result = { [1]: [2] for k, v in data.items() if [3] > 0 }The dictionary comprehension uses k.upper() to convert keys to uppercase, maps them to values v, and filters only positive values with v > 0.