Seaborn 資料視覺化中級
Chris Moffitt
Instructor
heatmap() 需要網格格式的資料。crosstab() 來整理資料。pd.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 會計算 DataFrame 欄之間的相關性。cols = ['total_rentals', 'temp', 'casual', 'hum', 'windspeed']
sns.heatmap(df[cols].corr(), cmap='YlGnBu')

Seaborn 資料視覺化中級