Tự động hóa biểu đồ từ dữ liệu

Nhập môn trực quan hóa dữ liệu với Matplotlib

Ariel Rokem

Data Scientist

Vì sao cần tự động hóa?

  • Nhanh và tiện
  • Linh hoạt
  • Mạnh mẽ
  • Tái lập
Nhập môn trực quan hóa dữ liệu với Matplotlib

Có bao nhiêu loại dữ liệu khác nhau?

summer_2016_medals["Sport"]
ID
62            Rowing
65         Taekwondo
73          Handball
             ...
134759      Handball
135132    Volleyball
135205        Boxing
Name: Sport, Length: 976, dtype: object
Nhập môn trực quan hóa dữ liệu với Matplotlib

Lấy các giá trị duy nhất của một cột

sports = summer_2016_medals["Sport"].unique()

print(sports)
['Rowing' 'Taekwondo' 'Handball' 'Wrestling' 
'Gymnastics' 'Swimming' 'Basketball' 'Boxing' 
'Volleyball' 'Athletics']
Nhập môn trực quan hóa dữ liệu với Matplotlib

Biểu đồ cột chiều cao theo từng môn

fig, ax = plt.subplots()

for sport in sports:
  sport_df = summer_2016_medals[summer_2016_medals["Sport"] == sport]

ax.bar(sport, sport_df["Height"].mean(), yerr=sport_df["Height"].std())
ax.set_ylabel("Height (cm)") ax.set_xticklabels(sports, rotation=90) plt.show()
Nhập môn trực quan hóa dữ liệu với Matplotlib

Hình tạo tự động từ dữ liệu

Nhập môn trực quan hóa dữ liệu với Matplotlib

Luyện tập tự động hóa trực quan hóa!

Nhập môn trực quan hóa dữ liệu với Matplotlib

Preparing Video For Download...