開始使用免費開始

從 DataFrame 繪製資料

pandas 的 DataFrame 是 Python 中最常用的資料結構之一。它由結構清楚且帶有標籤的資料組成,讓你能快速開始探索資料。探索 DataFrame 的最佳方式之一,就是善用 matplotlib 的威力。在本練習中,你將以視覺化的方式,探索存放在 freemont_df DataFrame 裡,西雅圖 Freemont 橋的自行車通行量。

記得,matplotlib 的設計初衷就是讓 MATLAB 使用者容易上手。

本練習屬於課程

給 MATLAB 使用者的 Python

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Create a bar plot of mean daily trips
plt.____(freemont_df.columns, 
         ____.mean(), 
         xerr=freemont_df.sem(), 
         capsize=3)

# Add an x-label and plot title
plt.xlabel('Average Trips')
plt.title('Average trips per day')

# Remember to show the plot
plt.show()
編輯並執行程式碼