Tạo biểu đồ cột

Nhập môn Khoa học Dữ liệu với Python

Hillary Green-Lerman

Lead Data Scientist, Looker

So sánh tội phạm thú cưng

precinct pets_abducted
Farmburg 10
Cityville 15
Suburbia 9
plt.bar(df.precinct,
        df.pets_abducted)

plt.ylabel('Pet Abductions')
plt.show()

Nhập môn Khoa học Dữ liệu với Python

Biểu đồ cột ngang

plt.barh(df.precinct,
        df.pets_abducted)

plt.ylabel('Pet Abductions')
plt.show()

Nhập môn Khoa học Dữ liệu với Python

Thêm thanh lỗi

plt.bar(df.precinct, df.pet_abductions,
        yerr=df.error)

plt.ylabel('Pet Abductions')
plt.show()

Nhập môn Khoa học Dữ liệu với Python

Biểu đồ cột chồng

Nhập môn Khoa học Dữ liệu với Python

Biểu đồ cột chồng

Nhập môn Khoa học Dữ liệu với Python

Biểu đồ cột chồng

Nhập môn Khoa học Dữ liệu với Python

Biểu đồ cột chồng

plt.bar(df.precinct, df.dog,
        label='Dog')

plt.bar(df.precinct, df.cat,
        bottom=df.dog,
        label='Cat')

plt.legend()
plt.show()

Nhập môn Khoa học Dữ liệu với Python

Ayo berlatih!

Nhập môn Khoa học Dữ liệu với Python

Preparing Video For Download...