Heatmaps
Heatmaps are a type of visualization that display correlations between different features of a dataset. Correlations can be positive or negative, and strong or weak.
The features are set as rows and columns, and the cells are color-coded based on their correlation value. Features with a high positive number are strongly positively correlated.
Exercise 10.05: Checking for Correlations between Features
In this exercise, you will plot a heatmap to observe whether there are any correlations between features of the new_air
DataFrame:
- Import
numpy
asnp
:import numpy as np
- Create a variable called
corr
that will store the correlations between the features ofnew_air
. Calculate these correlations by applying the.corr()
function onnew_air
:corr = new_air.corr()
- Mask the zero values using the
zeros_like()
function, withcorr
as the correlations to check, and setdtype
asnp.bool
:mask = np.zeros_like(corr, dtype=np.bool) mask[np.triu_indices_from(mask)]...