오류
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요
먼저 유사한 질문이 있었는지 검색해보세요
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부분
순서만 바꿔주면 되던데
왜 꼭 그래야만 하는지 이유를 모르겠어요.......
34강 평가지표
0
14
2
103강 작업2형 전처리(레이블인코딩 부분) 오류
0
8
2
작업형1_section14 문의
0
8
2
작업형1_연습문제 7번 관련입니다.
0
10
2
데이터 프레임 슬라이싱 혹은 데이터 선택하기가 어렵습니다.
0
10
2
크로스 밸리데이션 질문
0
14
2
로지스틱 회귀분석 질문
0
14
2
수치형 데이터만 선택하여 푸는 경우에 오답확률이 높아질까요?
0
23
2
2유형 object 컬럼 인코딩 관련 질문
0
32
2
하이퍼파라미터 변수
0
29
2
52강 이원분산분석
0
26
2
실제시험환경에서 작업형1,2,3의 문제풀이 순서
0
30
2
독립표본검정
0
25
2
tranform을 쓰라는 힌트는 어디서 얻을 수 있나요??
0
36
2
df.describe() 사용을 자제해야할까요?
0
35
2
shape 결과에 대한 문의
0
37
2
자료 문의
0
31
2
8 회귀 11번
0
26
2
심화 강의 관련 질문
0
35
2
빈도수 구하는 것 질문
0
26
2
커리큘럼을 따로 인쇄할 수 있는 방법이 있을까요?
0
38
1
작업형2 머신러닝 문제풀이 중 test 데이터 에러 문의
0
34
2
수강연장가능문의
0
45
2
59. 11회 기출 유형 작업형 1 - 문제2 관련
0
37
2





