Shouldn't it corelate month and yea in heatmap

doesn’t heatmap print corelation so when we pass it flight shouldn’t it corelate month and year(what about 3rd variable passengers

Hey @surbhi11, try to understand it like this way, In heatmap we need to pass a 2D matrix, and heatmap will plot the 2D matrix with each box having its color dependent on the value of that cell.

After agreeing the above fact, it will be easier for you to notice that, when we plot heat map of correlation between columns, we followed the given steps.

  1. Find the correlation matrix using .corr() function and saving it in variable.
  2. Secondly we pass that correlation matrix we made in previous step to make the heatmap.

It is to be noted that, heatmap function didn’t calculated the correlation. It just simple plots the values of the 2D matrix we pass. In this case it was correlation.

So here in month and year also, we just directly passed the 2D matrix to the heatmap function. And again heatmap function treated them like normal values and plotted the same 2D matrix.

Hope this resolved your doubt. :blush: