การใช้ pandas กับ Seaborn

การสร้างภาพข้อมูลด้วย Seaborn เบื้องต้น

Content Team

DataCamp

pandas คืออะไร?

  • ไลบรารี Python สำหรับการวิเคราะห์ข้อมูล
  • อ่านชุดข้อมูลจากไฟล์ csv, txt และรูปแบบอื่น ๆ ได้ง่าย
  • ชุดข้อมูลอยู่ในรูปแบบออบเจกต์ DataFrame
การสร้างภาพข้อมูลด้วย Seaborn เบื้องต้น

การทำงานกับ DataFrame

import pandas as pd

df = pd.read_csv("masculinity.csv")
df.head()
    participant_id        age    how_masculine    how_important
0                1    18 - 34         Somewhat         Somewhat
1                2    18 - 34         Somewhat         Somewhat
2                3    18 - 34             Very         Not very
3                4    18 - 34             Very         Not very
4                5    18 - 34             Very             Very
การสร้างภาพข้อมูลด้วย Seaborn เบื้องต้น

การใช้ DataFrame กับ countplot()

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.read_csv("masculinity.csv")
sns.countplot(x="how_masculine", data=df)
plt.show()

กราฟ count plot ของคอลัมน์ "how_masculine"

การสร้างภาพข้อมูลด้วย Seaborn เบื้องต้น

10 แถวแรกของ DataFrame masculinity

การสร้างภาพข้อมูลด้วย Seaborn เบื้องต้น

DataFrame แบบ "Untidy"

การสร้างภาพข้อมูลด้วย Seaborn เบื้องต้น

มาฝึกกันเถอะ!

การสร้างภาพข้อมูลด้วย Seaborn เบื้องต้น

Preparing Video For Download...