[pandas] ValueError: Bin labels must be one fewer than the number of bin edges
2023. 6. 26. 11:28ㆍTrouble shooting
pandas 로 data를 보고
나이를 나이대별로 그룹화 해서 보려던 도중
# 나이 구간 설정
bins = [0, 10, 20, 30, 40, 50, 60, 70, 80]
# 구간 라벨 설정
labels = ['0-9', '10-19', '20-29', '30-39', '40-49', '50-59', '60-69', '70-79', '80-89']
# 나이 구간 별로 새로운 컬럼 생성
data['AgeGroup'] = pd.cut(data['Age'], bins=bins, labels=labels)
ValueError: Bin labels must be one fewer than the number of bin edges
그냥 뜻 그대로 하나 더 적어야한다.
주의하자고 적어봄
728x90
'Trouble shooting' 카테고리의 다른 글
git) git push -> fatal: The current branch main has no upstream branch. (0) | 2023.07.25 |
---|---|
[tensorflow] RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd (0) | 2023.06.27 |
git) detected dubious ownership in repository (0) | 2023.05.22 |
한 컴퓨터에서 git 여러계정 사용 (해결중) (0) | 2023.05.22 |
pip install sklearn 오류 (0) | 2023.05.22 |