DataFrameからデータをプロットする
pandas のDataFrameは、Pythonで最もよく使われるデータ構造の一つです。見出し付きで整理されたデータを扱えるので、すぐに探索を始められます。DataFrameを探索するうえで有効なのが、matplotlib の可視化です。この演習では、シアトルのFreemont Bridgeでの自転車通行量を可視化します。データは freemont_df というDataFrameに入っています。
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()