开始使用免费开始使用

加载 DataFrame

我们仍在全力侦破金毛寻回犬 Bayes 的绑架案。此前,我们根据案发现场发现的一块车牌,将嫌疑人范围缩小到:

  • Fred Frequentist
  • Ronald Aylmer Fisher
  • Gertrude Cox
  • Kirstine Smith

我们已经拿到了这 4 位嫌疑人的信用卡记录。也许有人在绑架前有可疑消费?

这些记录保存在名为 "credit_records.csv" 的 CSV 文件中。

本练习是课程的一部分

Python 数据科学入门

查看课程

练习说明

  • pandas 模块以别名 pd 导入。
  • 将 CSV 文件 "credit_records.csv" 加载为名为 credit_records 的 DataFrame。
  • 使用 .head() 方法显示 credit_records 的前 5 行。

交互式实操练习

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

# Import pandas under the alias pd
____

# Load the CSV "credit_records.csv"
credit_records = ____

# Display the first five rows of credit_records using the .head() method
print(____)
编辑并运行代码