ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • ValueError: x and y must be the same size 에러 해결
    카테고리 없음 2024. 4. 8. 14:22

     

    plt.scatter() 함수에서 xy 인자로 전달된 데이터의 길이가 서로 다를 때 발생한다.

     

     

    해결방안

    1. 길이 확인

    print(len(X_test), len(y_test), len(y_test_pred))

     

     

    2. 인덱스 재설정

    X_test = X_test.reset_index(drop=True)
    y_test = y_test.reset_index(drop=True)

     

    때때로, 인덱스가 불일치하게 되어 길이가 같아서 데이터 매치가 되지 않는 경우가 존재한다.

Designed by Tistory.