시작하기무료로 시작하기

열 선택 오류 고치기

신입 형사가 credit_records의 위치 관련 열에 접근하려고 했지만 몇 가지 실수를 했어요. 의심스러운 구매를 찾을 수 있도록 그의 코드를 고쳐 주세요.

앞으로 나오는 모든 연습 문제에서는 pandaspd로 임포트되어 있어요. 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)
코드 편집 및 실행