开始使用免费开始使用

从 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()
编辑并运行代码