开始使用免费开始使用

绘制手机数据图

我们已经知道,是 Freddy Frequentist 绑架了金毛犬 Bayes。接下来要找出他藏在哪里。

警局的朋友拿到了手机数据,包含了过去 3 周内 Freddie 的部分位置。这些数据保存在 DataFrame cellphone 中。x 坐标在列 'x',y 坐标在列 'y'

matplotlib 模块已用别名 plt 导入。

本练习是课程的一部分

Python 数据科学入门

查看课程

练习说明

  • 显示该 DataFrame 的前 5 行,并确定要绘制的列。
  • 使用 cellphone 中的数据创建一个散点图。

交互式实操练习

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

# Explore the data
print(cellphone.____)

# Create a scatter plot of the data from the DataFrame cellphone
plt.____(____, ____)

# Add labels
plt.ylabel('Latitude')
plt.xlabel('Longitude')

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