Heatmaps
Heatmaps are crazy useful. I use them as diagnostic plots to take a look at the feature correlation in my data frame and to understand the cross-dimensional count of my data. Basically, heatmaps tell me if there are any red flag in my data. Often really redundant data has these crazy fractal patterns in it.
Import Preliminaries¶
%matplotlib inline
%config InlineBackend.figure_format='retina'
# Import modules
import numpy as np
import pandas as pd
import seaborn as sns
# Creating the dataframe
df = pd.DataFrame()
index = pd.date_range(start='2017-10-1', end='2017-10-15', freq='D')
cols = ['Group A', 'Group B','Group C','Group D']
df = pd.DataFrame(data = abs(np.random.randn(15,4)),
index=index, columns=cols )
# View the dataframe
df.head(5)
Heatmap¶
# plot a heatmap using seaborn
sns.heatmap(df,annot=True);
Author: Karvi Sekhon