인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

한다경's profile image
한다경

asked

Getting started with Python data analysis using public data

[6/20] Reduce memory capacity by changing the size classification column to a dedicated area and removing unused columns

KeyError, not found in axis

Written on

·

5.4K

3

df_last = df_last.drop(["규모구분","분양가격(㎡)"], axis=1)

의 코드를 입력하고 KeyError가 사진에서처럼 떠요. 도와주세요 ㅠㅠ

numpypandaspython

Answer 3

2

todaycode님의 프로필 이미지
todaycode
Instructor

안녕하세요.

아마도 해당 셀을 실행한 후에 다시 실행하셨을 거 같아요.

이미 삭제된 컬럼인데 다시 삭제하려고 해서 KeyError 가 발생하고 있어요.

코드의 맨 윗줄 부터 다시 데이터를 불러와서 실행해 보시면 잘 동작할거에요.

그리고 해당 셀을 다시 실행해 보시면 위와 같은 메시지가 나올거에요.

1

한다경님의 프로필 이미지
한다경
Questioner

다시 불러오니 해결되었어요~ 감사합니다 ^^

0

todaycode님의 프로필 이미지
todaycode
Instructor

감사합니다 :)

한다경's profile image
한다경

asked

Ask a question