开始使用免费开始使用

修改直方图

来看看在直方图中调整关键字参数会如何影响输出。回顾一下:

  • range 设置要包含在直方图中的数据点最小值和最大值。
  • bins 设置直方图的柱数。

我们将使用 DataFrame puppies 中多只幼犬的体重。matplotlib 已以别名 plt 导入。

本练习是课程的一部分

Python 数据科学入门

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Create a histogram of the column weight from the DataFrame puppies
____(____.____)

# Add labels
plt.xlabel('Puppy Weight (lbs)')
plt.ylabel('Number of Puppies')

# Display
plt.show()
编辑并运行代码