การสร้างภาพข้อมูลระดับกลางด้วย Seaborn
Chris Moffitt
Instructor
heatmap() ของ Seaborn ต้องการข้อมูลในรูปแบบกริดcrosstab() ของ pandas ใช้จัดรูปแบบข้อมูลบ่อยครั้ง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 ของ pandas คำนวณค่าสหสัมพันธ์ระหว่างคอลัมน์ใน DataFramecols = ['total_rentals', 'temp', 'casual', 'hum', 'windspeed']
sns.heatmap(df[cols].corr(), cmap='YlGnBu')

การสร้างภาพข้อมูลระดับกลางด้วย Seaborn