纠正列选择错误
一位初级侦探尝试访问 credit_records 的位置相关列,但写错了代码。请帮他纠正,这样我们才能搜索可疑消费。
接下来的所有练习中,pandas 都将以 pd 导入。
DataFrame credit_records 已经导入。
本练习是课程的一部分
Python 数据科学入门
练习说明
- 纠正代码,使其能够无错误运行。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# One or more lines of code contain errors.
# Fix the errors so that the code runs.
# Select the location column in credit_records
location = credit_records[location]
# Select the item column in credit_records
items = credit_records."item"
# Display results
print(location)