오류
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요
먼저 유사한 질문이 있었는지 검색해보세요
import pandas as pd
train = pd.read_csv("data/customer_train.csv")
test = pd.read_csv("data/customer_test.csv")
pd.set_option('display.max_columns',None)
train['환불금액'] = train['환불금액'].fillna(0)
test['환불금액'] = test['환불금액'].fillna(0)
cols = train.select_dtypes(exclude='object').columns
target = train.pop('성별')
from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier()
rf.fit(train[cols], target)
pred = rf.predict_proba(test[cols])
print(pred)
오류
Makefile:6: recipe for target 'py3_run' failed
make: *** [py3_run] Error 1
Traceback (most recent call last):
File "/goorm/Main.out", line 29, in <module>
model.fit(train[cols], target)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/frame.py", line 3511, in getitem
indexer = self.columns._get_indexer_strict(key, "columns")[1]
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py", line 5782, in getindexer_strict
self._raise_if_missing(keyarr, indexer, axis_name)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py", line 5845, in raiseif_missing
raise KeyError(f"{not_found} not in index")
KeyError: "['성별'] not in index"
도와주세요 왜 select_dtypes로 쓰니까 안되나요
답변 2
0
순서 문제 맞아요
test[cols]에서 '성별' 컬럼이 없는데 cols에 사용해서 에러가 발생합니다
0
test[cols]에서 '성별' 컬럼이 없는건 이해했는데
cols에 성별을 사용했다는게 무슨 말인지 모르겠씁니다 ㅜㅜㅜ
cols= 부분이랑
pop부분
순서만 바꿔주면 되던데
왜 꼭 그래야만 하는지 이유를 모르겠어요.......
작업형2에서 데이터 분포를 확인하는 이유
0
17
2
10회 기출 작업형 2 문제
0
18
1
코딩팡 프로 인증
0
22
1
이번 강의 학습노트
0
18
2
캐글 질문
0
17
2
코딩팡 pro 관련
0
20
1
9번질문입니다.
0
22
2
시험에 대해서
0
21
2
12회 작업형 2
0
25
2
copy()
0
26
2
딴짓코치 이용
0
21
1
수강 관련 문의 드립니다.
0
62
4
자치구 상점 수 합(12회)
0
29
1
불균형데이터 처리 전후 비교
0
34
2
레이블인코딩/원핫
0
44
2
인코딩
0
43
2
작업형 2 작업
0
42
2
ttest_rel() 관련 질문
0
51
2
작업형2. 인코딩에 대해 질문드립니다.
0
39
2
작업형3 2-3
0
47
1
코딩팡 2호선 전처리 종합 28번 중고 카메라 매입가 문제 최적화 질문드립니다.
0
40
1
8회 작업형2
0
39
2
작업형2 모의문제2 updated 2026.10
0
54
3
단순선형 회귀분석 신뢰구간,예측구간 관련질문
0
48
2





