Intermediate Data Visualization with Seaborn
Chris Moffitt
Instructor
heatmap()
function requires data to be in a grid formatcrosstab()
is frequently used to manipulate the datapd.crosstab(df["mnth"], df["weekday"],
values=df["total_rentals"],aggfunc="mean").round(0)
sns.heatmap(pd.crosstab(df["mnth"], df["weekday"],
values=df["total_rentals"], aggfunc="mean")
)
sns.heatmap(df_crosstab, annot=True, fmt="d",
cmap="YlGnBu", cbar=False, linewidths=.5)
sns.heatmap(df_crosstab, annot=True, fmt="d",
cmap="YlGnBu", cbar=True,
center=df_crosstab.loc[9, 6])
corr
function calculates correlations between columns in a dataframecols = ['total_rentals', 'temp', 'casual', 'hum', 'windspeed']
sns.heatmap(df[cols].corr(), cmap='YlGnBu')
Intermediate Data Visualization with Seaborn