加载 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(____)